- 50 shades of Go: traps, gotchas, and common mistakes
- A curated list of awesome frameworks, libraries and software
- A curated list of awesome storage projects and libraries
- A curated selection of blog posts
- Adopting Go Modules and integrating with Github Actions - Handle different application versions and conditional build in GitHub Actions
- Applying the clean architecture
- Best practice for accessing database in HTTP handlers
- Best practices for writing high-performance code
- Build your own web framework
- Elegant HTTP error handling
- Error handling
- Four Steps to Daemonize Your Go Programs
- Functional Options - Implementing clean APIs
- Go by Example
- Go Web Examples
- How to improve latency by 700% using sync.Pool
- How to Structure a Go Command-Line Project
- Implementing Clean Arhitecture in Go - DDD
- Integration with systemd
- Packaging application for OSX
- Packing multiple binaries in a package
- Practical Go: Real world advice for writing maintainable Go programs
- Rosetta Code
- Shrink your binaries with this one weird trick
- Simple HTTP request context example
- Stripping dependency bloat
- Supercronic - crontab-compatible job runner designed to run in containers
- Thanos Coding Style Guide
- Ultimate Go - notes on work with Go
- Using the Service Object pattern
- Why Go’s Cmd.Run fails without /dev/null
- Working with Errors in Go 1.13
- How to Implement Domain-Driven Design in Go
- Go Code Review Comments
- Style Guide
- Exploring Network Programming by Building a Toxiproxy Clone
- Designing Go Libraries
- Common Anti-Patterns in Go Web Applications
- A pragmatic guide to Go module updates
- Developing a major version update
- 7 Common Interface Mistakes in Go
- 100 Go Mistakes and How to Avoid Them
- A Journey With Go
- Applied Go
- Ardan labs
- Dave Cheney
- Dev
- Digital Ocean
- Eli Bendersky
- Go Articles Wiki
- Golang Bot
- Golang Code
- Golang Programs
- Gopher Academy
- Gopher Guides
- Hashnode
- Ilija Eftimov
- ITNEXT
- Ivan Daniluk
- Johan Brandhorst
- justforfunc
- Learning the Go Programming Language
- Official
- Russ Cox
- Tit Petric
- TutorialEdge
- WanderingThoughts
- Eli Bendersky - Go and Rust articles
- Three Dots Labs
- Channel use cases
- Common concurrent programming mistakes
- Concurrency and a mini load-balancer
- Data races and how to fix them
- Go Concurrency Patterns: Pipelines and cancellation
- Handling 1 million requests per minute
- Interesting ways of using channels
- Load balancer
- Principles of designing Go APIs with channels
- Applying Modern Go Concurrency Patterns to Data Pipelines
- broadcast - library that allows sending repeated notifications to multiple goroutines with guaranteed delivery
- errgroup
- Pipelines and cancellation
- Implementing graceful shutdown
- Behavior Of channels
- The Behavior Of Channels
- signal.NotifyContext - handling cancellation with Unix signals using context
- Go, Generics, and Concurrency (with Promise example)
- ZenQ - low-latency thread-safe queue implemented using a lock-free ringbuffer (faster than channels)
- Concurrency Guide
- ThreadSanitizer - typical data races
- Uber data race patterns
- xsync - Concurrent data structures - counter, map and queue
- Data Race Patterns in Go
- spinlock
- concurrent map (sharded)
- Advanced Go Concurrency (singleflight, bounded concurrency, weighted bounded concurrency)
- Limit goroutines with buffered channels
- conc - better structured concurrency for Go
- go generics for the busy gopher
- Juniper - extensions to the Go standard library using generics, including containers, iterators, and streams
- Generic Data Structures
- mo - Monads and popular functional programming abstractions, Option, Result, Either, Future
- Crimes with Go Generics
- Learning Go - Chapter 15 - Welcome to the Future: Generics in Go
- Writing generic collection types in Go: the missing documentation
- aah - a secure, flexible, rapid Go web framework
- API Design Cheat Sheet
- Authenticate a Go API with JSON web tokens
- chi
- Create Secure Clients and Servers in Golang Using HTTPS
- Creating the V in MVC
- Expose Go on the Internet
- Fiber - Express-inspired web framework using Fasthttp
- GO_REUSEPORT
- Gocraft
- Goyave - progressive and accessible web application framework
- How I write HTTP services after seven years
- http.Handler wrapper technique
- Serve local files
- Swagger Generator, UI, and Validation
- REST Servers in Go 1/4: standard library
- REST Servers in Go 2/4: using a router package
- REST Servers in Go 3/4: using a web framework
- REST Servers in Go 4/4: using OpenAPI and Swagger
- Example SSE server
- Coraza - Web Application Firewall
- Limiter - dead simple rate limit middleware
- Writing a Server Sent Events server
- Things to know about HTTP
- SSL Configuration Generator
- Validating HTTP JSON Requests
- Bud - Fullstack Go Framework for Prolific Web Developers
- quicktemplate - fast, powerful and easy to use template engine
- Using Server Sent Events to Simplify Real-time Streaming at Scale
- OpenAPI code generation example - article
- OpenAPI code generation example - code
- OpenAPI code generation - example project
- oapi-codegen - generate Go client and server boilerplate from OpenAPI 3 specifications
- FormStream - streaming parser for multipart data primarily used in web form submissions and file uploads
- How to Implement Server-Sent Events in Go
- An SWT based API for managing users and issuing SWT tokens
- Go password validator
- JWT auth in Go
- JWT auth in Go Part 2 — Refresh Tokens
- Ory Kratos - security-hardened and battle-tested identity, user management and authentication system
- jwt-go
- jwx - JWA/JWE/JWK/JWS/JWT implementations
- Generate TOTP (2FA token)
- Casbin custom functions
- How to implement RBAC custom function which has to read information from database?
- Oso - policy engine for authorization
- Basic Role-Based HTTP Authorization in Go with Casbin
- SpiceDB - database system for managing security-critical application permissions
- Permify - authorization service & policy engine based on Google Zanzibar
- Warrant - access control service inspired by Google Zanzibar
- Don’t use default HTTP client in production
- Resty - imple HTTP and REST client library
- Transport for http.Client that will cache responses according to the HTTP RFC
- Ferret - web scraper
- Colly - Lightning Fast and Elegant Scraping Framework
- How to customize Go's HTTP client
- Gohalt - Throttler library & client rate limiter
- gobreaker implements Circuit Breaker patter
- From 0 to Insight with OpenTelemetry in Go
- Golang Application monitoring using Prometheus
- OpenTelemetry-Go
- GChalk - Terminal string styling
- Glow - Render markdown on the CLI
- PTerm - Pretty Terminal Printer
- Lip Gloss - Style definitions for nice terminal layouts
- konfig - composable, observable and performant config handling for Go for the distributed processing era
- A clean way to pass configs
- Kong
- promptui - interactive prompt for command-line applications
- tview - terminal UI library with rich, interactive widgets
- gum - tool for glamorous shell scripts
- Extending pflag with environment variables
- Docker powered development environment for your web app
- Mocking Mongo
- Writing integration tests with mongoDB support
- Build and Push Docker Images with Go
- Building Distributed Event Streaming Systems In Go With NATS JetStream
- NATS Surveyor - NATS monitoring, simplified
- Streams
- Queue Subscriptions
- Draining Messages Before Disconnect
- Tutorials
- plumber - CLI devtool for inspecting, piping, massaging and redirecting data in message systems
- Make sure your connection to RabbitMQ stays active
- Using AMQP in a single goroutine that publishes and consumes
- HTTP AMQP Proxy
- Tips for using RabbitMQ
- Examples
- Make sure your connection to RabbitMQ stays active
- Shim is a thin layer between API Gateway integration requests via Lambda and the standard library http.Handler interface
- Porting web applications to AWS Lambda
- AWS Lambda proxy - run Lambda function on your machine
- Getting started with serverless
- How to build a Serverless API with AWS Lambda
- Face Detection using OpenCV and MachineBox
- ChatGPT, Wardley and Go
- Building LLM-powered applications in Go
- LangChain Go - building applications with LLMs
- Weaviate - robust, fast and scalable cloud-native open source vector database
- Gemini API client
- RAG server example
- Ollama - run large language models locally
- JSON and struct composition
- JSON decoding
- Custom JSON marshalling
- YAML marshaling and unmarshaling (used in Kubernetes)
- Sonic - blazingly fast JSON serializing & deserializing library
- fastjson - fast JSON parser and validator
- JSON to Go
- jsoniter - high-performance drop-in replacement of encoding/json
- ffjson - faster JSON for Go (code generator)
- pkg/json - alternative JSON decoder for Go
- SQLX - extensions on top of database/sql package
- Grimoire ORM
- kingshard - high-performance proxy for MySQL
- Vitess - database clustering system for horizontal scaling of MySQL
- Nap - library that abstracts access to master-slave physical SQL servers
- goose - database migration tool
- migrate - database migrations written in Go
- sqlc generates fully type-safe idiomatic Go code from SQL
- SQLBoiler - tool to generate a Go ORM tailored to your database schema
- Writing an application using Go and PostgreSQL
- pgxtutorial
- Tern - standalone migration tool for PostgreSQL
- scany - library for scanning data from a database into Go structs
- pgtools - code and infrastructure for working more effectively with PostgreSQL and Go using pgx, tern, and scany
- FerretDB - proxy converting the MongoDB wire protocol queries to SQL using PostgreSQL as a database engine
- Jet - SQL builder with code generation and automatic query result data mapping
- Distributed tracing in 10 minutes
- Building a microservices application following the CQRS pattern
- Microservices
- Microservices example
- Automatically set GOMAXPROCS to match Linux container CPU quota
- Kratos - microservice oriented governance framework
- How to do Continuous Integration like a boss
- Building a CI system with Jenkins
- Go recipes - handy commands to run in Go projects
- gta - monorepo transitive analysis to find packages whose dependencies have changed
- GoConvey - automatic web UI for testing
- Collection of tools and libraries including linters and static analysis
- GopherCI helps you maintain high-quality Go projects by checking each GitHub pull request
- SonarQube
- Overview of tooling
- Find outdated dependencies
- Using Makefiles for Go
- ko - tool for building and deploying Golang applications to Kubernetes
- Chronos - static race detector
- structslop - checks if struct's fields can be re-arranged to get optimal struct size
- goreadme - generates readme markdown file from go doc - contains github action as well
- GoKart - Go Security Static Analysis
- nancy - tool to check for dependencies' vulnerabilities
- Don’t afraid of makefiles
- leaf - general purpose reloader for all projects
- Air - live reload for Go apps
- Advanced testing
- In-memory network stack
- Testing HTTP handlers
- go-replayers - tools for recording and replaying RPCs
- httpexpect - Concise, declarative, and easy to use end-to-end HTTP and REST API testing for Go
- Testing with golden files in Go
- copyist - Mocking your SQL database in Go tests has never been easier
- Go advanced testing tips & tricks
- aceptadora - boilerplate to orchestrate the containers for an acceptance test
- Mock DB for testing HTTP API in Go and achieve 100% coverage
- gomock - mocking framework
- Testcontainers - friendly API to run Docker container, designed to create runtime environment for automatic tests
- dockertest - use Docker to run your Go integration tests against third party services
- Go integration tests with Postgres
- Gnomock - integration and e2e testing toolkit using Docker temporary containers
- strikememongo - package that spins up a real MongoDB server, backed by in-memory storage, for use in testing and mocking during development
- go-cmp - package for equality of Go values
- embedded-postgres - run a real Postgres database locally as part of another Go application or test
- goleak - go routine leak detector
- sqlmock - mock library implementing sql/driver
- pgx driver mock
- ooze - mutation testing
- f-tests as a replacement for table-driven tests in Go
- fgprof - profiler that allows you to analyze On-CPU as well as Off-CPU (e.g. I/O) time together
- profefe continuously collects profiling data
- Block Profiling in Go
- Fixing Memory Exhaustion Bugs
- GopherCon Europe 2022: Bill Kennedy - Practical Memory Profiling
- Statsviz - visualise Go program runtime metrics data in real time: heap, objects, goroutines, GC pauses, scheduler, etc. in your browser
- Building high performance API's using gRPC and Protocol Buffers
- gRPC gateway
- How to develop gRPC microservice - Part 1
- How to develop gRPC microservice - Part 2: HTTP/REST endpoint
- How to develop gRPC microservice - Part 3: Middleware
- protoc-gen-mock - Plugin to generate gRPC mock services from protobuf specifications
- Awesome gRPC
- Wombat - Cross platform gRPC client (can be used to test gRPC servers)
- Evans - expressive universal gRPC CLI client
- Unit testing Golang gRPC client and server application with bufconn package
- Server reflection service
- gRPC Long-lived Streaming
- Generate a fully-working Go gRPC server in two minutes with Ent
- Connect - slim library for building browser and gRPC-compatible HTTP APIs
- DRPC - drop-in, lightweight gRPC replacement
- vtprotobuf - Vitess Protocol Buffers compiler
- Securing gRPC Services with JWT Authentication in Go
- Implementing Redlock on Redis for distributed locks
- Demo Redlock
- Redsync
- How to do distributed locking
- redislock - simplified distributed locking implementation using Redis
- pglock - PostgreSQL lock client
- groupcache/lru
- Ristretto - fast, concurrent cache library
- EasyCache - simple way to use in-memory cache
- File type discovery using magic numbers
- v8go - Execute JavaScript from Go
- x/text - packages related to internationalization (i18n) and localization (l10n)
- MTProto - Full-native implementation of MTProto (Telegram) protocol
- Mux Go - Official Mux API wrapper for golang projects, supporting both Mux Data and Mux Video
- Pigo - pure Go face detection
- libp2p - protocols, specifications and libraries for peer-to-peer network applications
- WebAssembly Powered Go Playground
- Reading files
- Ultimate Visual Guide to Go Enums and iota
- gopkg.in - versioned URLs that offer the proper metadata for redirecting the go tool onto well defined GitHub repositories
- go-nanoid - very fast and efficient unique ID generator
- Free Gophers Pack - pack of 100+ gopher pictures and elements
- Better playground
- gnet - high-performance, lightweight, non-blocking, event-driven networking framework
- gnet examples
- stats - comprehensive statistics library
- SwissMap - hash map with fast-hashing and parallel key lookups (faster than map)
- go-nbd - turn a file, byte slice, S3 bucket or other io.ReadWriter into a fully-fledged block device
- go2rtc - ultimate camera streaming application
- when - natural language date/time parser with pluggable rules and merge strategies
- lo - iterate over slices, maps, channels
- decimal - arbitrary-precision fixed-point decimal numbers in Go (useful for monetary values)
- golangci-lint example configuration
- Modern Go application - application boilerplate and example applying modern practices
- River - robust high-performance job processing system with UI dashboard
- notify - simple Go library for sending notifications to various messaging services
- ergo - actor-based framework with network transparency for creating event-driven architecture
- fyne - cross platform GUI (docs)
- MacDriver - native Mac APIs for Golang
- wails - create beautiful desktop applications
- How I build simple Mac apps using Go
- Sample controller
- Testing controllers
- Testing examples
- Leader Election Example
- Writing a Kubernetes Admission Controller
- Build a Highly Available Kubernetes Operator
- So you wanna write Kubernetes controllers?
- geodist - compute the distance between two geographic latitude and longitude coordinates
- Visualizing map data with Go and Leaflet JS
- How to create an SSH tunnel
- vssh - library to handle tens of thousands SSH connections and execute the command(s)
- SSH port forwarding with Go
- Cybertron - simple and easy-to-use interface for cutting-edge Natural Language Processing technologies
- spaGO - self-contained ML and NLP library
https://play.golang.org/p/n3iH7H11Uoe
package main
const N = 3
func main() {
m := make(map[int]*int)
for i := 0; i < N; i++ {
m[i] = &i //A
}
for _, v := range m {
print(*v)
}
}
https://play.golang.org/p/BW0lY5dW7ZJ
package main
import (
"io/ioutil"
"os"
)
func main() {
f, err := os.Open("file")
defer f.Close()
if err != nil {
return
}
b, err := ioutil.ReadAll(f)
println(string(b))
}
https://play.golang.org/p/zgSTwr035YQ
package main
import (
"sync"
)
const N = 10
func main() {
m := make(map[int]int)
wg := &sync.WaitGroup{}
mu := &sync.Mutex{}
wg.Add(N)
for i := 0; i < N; i++ {
go func() {
defer wg.Done()
mu.Lock()
m[i] = i
mu.Unlock()
}()
}
wg.Wait()
println(len(m))
}
https://play.golang.org/p/6bzWYtdAh9K
package main
func main() {
s := "123"
ps := &s
b := []byte(*ps)
pb := &b
s += "4"
*ps += "5"
b[1] = '0'
println(*ps)
println(string(*pb))
}