Skip to content

ewriq/awesome-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 

Repository files navigation

Awesome Go

Awesome

A curated list of awesome libraries, tools, and resources for the Go programming language.

Contents


Web Frameworks

  • Gin - Arguably the most popular and widely used Go web framework. Although it has a Martini-like API, it is extremely fast thanks to its Radix tree-based routing. It has a large community and a rich ecosystem of middleware. It is one of the safest starting points for new projects.
  • Fiber - A framework that is extremely easy and enjoyable to use, strongly inspired by Express.js from the Node.js world. It is built on top of fasthttp instead of Go's standard net/http package, making it one of the fastest web frameworks available. It is very easy to adapt for developers with Express experience.
  • Echo - Another popular high-performance, minimalist, and extensible framework. It features a powerful router, a rich set of middleware, and built-in support for template rendering. It is often mentioned alongside Gin and Fiber as one of the best minimalist frameworks.
  • Chi - Stands out for being lightweight, idiomatic, and composable. The biggest advantage of chi is its full compatibility with Go's standard net/http package. This means you can use existing net/http-compatible middleware without any changes. It is one of the frameworks most faithful to Go's philosophy.
  • Gorilla/Mux - One of the oldest and most established routers in Go. It is more of a powerful router and dispatcher than a full-fledged framework. It forms the basis of many large and legacy projects. It is known for its flexible routing rules and robustness. Although it is now community-managed, it is still very common.

Database

ORM and Database Tools

  • GORM - A developer-friendly, full-featured ORM library for Go.
  • SQLx - A general-purpose SQL extension for Go that extends the standard database/sql package.
  • ent - A simple yet powerful entity framework and ORM for Go.
  • SQLBoiler - A lightning-fast ORM generator, tailor-made for you from your database schema.
  • sqlc - Compile SQL to type-safe code
  • FluentSQL - flexible and powerful SQL string builder

Database Drivers

  • pgx (PostgreSQL) - A high-performance and full-featured driver and toolkit for PostgreSQL. It offers direct access to advanced PostgreSQL features (e.g., JSONB support) beyond the standard database/sql interface. It is the most recommended driver for modern projects.
  • go-sql-driver/mysql (MySQL) - The most popular, stable, and full-featured MySQL driver for Go's database/sql package. It forms the basis of almost all MySQL-based projects.
  • modernc.org/sqlite (SQLite) - A modern SQLite driver written in pure Go that does not require CGO. This feature makes cross-compilation extremely easy and eliminates external dependencies.
  • mattn/go-sqlite3 (SQLite) - One of the oldest and most common database/sql-compatible drivers for SQLite3. It wraps the SQLite C library using cgo.
  • microsoft/go-mssql (Microsoft SQL Server) - The official database/sql-compatible driver for Microsoft SQL Server.
  • lib/pq (PostgreSQL) - A long-established PostgreSQL driver written in pure Go. Although it is in maintenance mode, it is still used in many projects.
  • mongo-go-driver (MongoDB) - The official MongoDB driver for the Go language. It does not use the database/sql interface; it has its own rich and idiomatic API.
  • redis/go-redis (Redis) - The most popular, full-featured, and high-performance Redis client for Golang. It is the standard for interacting with this in-memory data store, which is also used as a database.
  • gocql/gocql (Cassandra) - The most widely used Go driver for Apache Cassandra. It is highly configurable and performance-oriented.
  • sijms/go-ora (Oracle) - A driver for Oracle Database written in pure Go. Its biggest advantage is that it does not require annoying external dependencies like an Oracle Instant Client installation.

Command Line Interface (CLI)

  • Cobra - A powerful library for creating modern Go CLI applications.
  • urfave/cli - A simple, fast, and fun package for building command-line apps in Go.
  • Bubble Tea - A Go framework for building terminal applications based on The Elm Architecture.
  • ...add others here...

Configuration

  • Viper - The most powerful and full-featured configuration library in the Go ecosystem.
    • Can read many file formats like JSON, YAML, TOML, .env, and Java properties.
    • Automatically reads and binds environment variables.
    • Can integrate command-line flags.
    • Can perform live watching of configuration and reload changes.
    • It is a "do-it-all" solution for almost all configuration needs.
  • koanf - A modern, lightweight, and highly modular alternative to Viper.
    • Reads from files, environment variables, or remote sources like etcd through configurable "providers."
    • Stands out with its flexible structure and clean API. It offers powerful features without the complexity of Viper.
  • godotenv - A very simple library that does one job very well: loading environment variables from .env files. It is often used to facilitate adherence to 12-factor app principles in development environments.
  • envconfig - Popular especially for containerized and cloud-native applications. It has a single purpose: to populate a Go struct directly from environment variables. It is very simple and effective to use.
  • cleanenv - A configuration library that adopts "clean architecture" principles. It focuses on loading configuration from files and environment variables into a Go struct with clean and minimal code, using struct tags.

Logging

  • Zap - A library for fast, structured, and leveled logging.
  • Logrus - Structured and pluggable logging for Go.
  • zerolog - A JSON logger that performs zero-allocation.

Testing

  • Testify - The Swiss Army knife of the Go testing ecosystem. It is the most popular toolkit that enriches the standard testing package.
    • assert: A rich set of assertions that allow the test to continue even if it fails (assert.Equal(t, 1, 1)).
    • require: An assertion set that stops the test immediately (t.Fatal) when an assertion fails.
    • suite: Facilitates setup and teardown logic by grouping tests within structs.
  • go-cmp - A library for safely comparing complex data structures (structs, slices, etc.) in tests. It stands out for being much safer and more configurable than reflect.DeepEqual.
  • testing - The foundation of everything. The core package that comes with the standard library, providing the ability to create sub-tests with t.Run, mark helper functions with t.Helper, and offering basic test structures (*testing.T).
  • GoMock - Developed by the Go team, this framework has become the standard for isolating dependencies in unit tests by generating mock implementations from interfaces. It automatically creates mocks with the mockgen tool.
  • gofakeit - An excellent library for programmatically generating tons of fake but realistic data for tests (names, addresses, UUIDs, credit card numbers, random texts, etc.).
  • sqlmock - Allows creating a fake SQL driver when testing code that uses database/sql, without needing a real database connection. It is used to mock database interactions.
  • testcontainers-go - Indispensable for integration tests. It allows for programmatically creating Docker containers (PostgreSQL, Redis, Kafka, etc.) during tests and automatically destroying them when the test is finished.
  • net/http/httptest - The standard library's basic package for testing HTTP handlers, which allows for creating fake HTTP requests and running in-memory servers.
  • httpexpect - Built on top of httptest, this library allows for end-to-end testing of APIs with a fluent and BDD (Behavior-Driven Development) style syntax (Expect().Status(http.StatusOK).JSON().Object()...).

Advanced and Specialized Tools

  • Built-in Fuzzing (testing.F) - Added to the standard library with Go 1.18, this is a powerful testing technique that automatically finds unexpected errors and edge cases by sending random inputs to a function.
  • Godog - Inspired by Cucumber, this is the most popular Behavior-Driven Development (BDD) framework for Go. It links test scenarios written in the Given-When-Then format to Go functions.
  • goleak - A tool that ensures the cleanliness of tests by checking if any goroutines have been leaked after the tests have finished, especially in concurrent programs.

Security

  • golang.org/x/crypto - Go's semi-standard cryptography library. The bcrypt package, in particular, is considered the industry standard for securely hashing passwords.
  • golang-jwt/jwt - The most popular, full-featured library for creating, parsing, and validating JSON Web Tokens (JWT). It forms the basis of stateless authentication for APIs.
  • casbin - An extremely powerful and flexible authorization library. It supports many access control models like ACL, RBAC, and ABAC, and makes it easy to manage "who can do what to which resource."
  • oauth2 - Developed by the Go team, this is the core library for managing the client side of the OAuth 2.0 standard, used to implement features like "Sign in with Google/GitHub/Facebook."
  • crypto/* - The set of packages in Go's standard library that provides all the basic building blocks for fundamental cryptographic operations (AES, RSA, SHA256, etc.).
  • lego - A library written in pure Go, used to automatically obtain and renew SSL/TLS certificates from Let's Encrypt and other ACME-based certificate authorities. It's great for automating HTTPS.
  • bluemonday - A powerful, policy-based HTML sanitizer used to clean user-submitted HTML input from malicious code (like XSS attacks).
  • crypto/tls - The standard library's core package that enables HTTPS and other secure network communications.
  • govulncheck - The Go team's official security tool. It scans your project's dependencies to detect packages with known vulnerabilities. It stands out by only reporting vulnerabilities that your code actually calls.
  • gosec - A linting tool that statically analyzes Go source code to detect common security vulnerabilities like SQL injection, hardcoded credentials, and insecure blocks.
  • mkcert - A simple tool for creating valid and trusted TLS certificates for local development environments (like localhost). It helps you get rid of browser warnings when developing with HTTPS.

API and RPC

  • gRPC-go - The official implementation of gRPC for Go. A high-performance RPC framework based on HTTP/2, developed by Google.
  • Gin - A very fast and popular HTTP web framework that uses Radix tree-based routing.
  • Fiber - An easy-to-use and extremely fast web framework inspired by Express.js, built on fasthttp.
  • Echo - A high-performance, minimalist, and extensible web framework that offers powerful templating and middleware support.
  • chi - A lightweight, idiomatic, and composable HTTP router that is fully compatible with net/http.
  • gorilla/mux - A powerful URL router and dispatcher for routing incoming requests to their target handlers. It has long been a cornerstone of the Go ecosystem.
  • gqlgen - A library that has become the standard for building GraphQL servers by generating type-safe Go code from a GraphQL schema.
  • Twirp - A Protobuf-based RPC framework developed by Twitch, which is simpler than gRPC and supports both JSON and Protobuf.
  • gRPC-Gateway - A plugin that automatically generates a RESTful JSON proxy for your gRPC services. It allows you to serve both RPC and REST APIs from a single gRPC definition.
  • Go-kit - A modular, composable programming toolkit for building distributed and robust microservices. It offers an architectural approach, not just a framework.
  • go-zero - A full-featured framework for web and RPC, packed with code generation features. It is designed for high-concurrency scenarios.
  • fasthttp - A high-performance alternative to the standard net/http. It forms the basis of many frameworks like Fiber and is used for APIs where speed is critical.
  • Hertz - An HTTP framework developed by Bytedance, focusing on high performance, extensibility, and ease of use.
  • Goa - A framework that allows you to create APIs with a design-first approach. It generates code and documentation from your design.
  • emicklei/go-restful - A library designed for creating RESTful web services, inspired by Java frameworks like JAX-RS and Spring Framework.
  • Kratos - Developed by Bilibili, a microservice-oriented framework inspired by Go-kit, offering gRPC and HTTP as standards.
  • gorilla/websocket - A full-featured and widely used WebSocket implementation for Go. It is indispensable for real-time APIs.
  • rpcx - A high-performance, distributed, and pluggable RPC service framework, similar to Alibaba's Dubbo.
  • kitex - A high-performance and extensible RPC framework developed by Bytedance, supporting Thrift and Protobuf.
  • net/http - Go's standard library. It provides the fundamental building blocks for creating powerful, production-ready APIs without any external dependencies. All other libraries either wrap it or offer an alternative to it.

Tooling

  • golangci-lint - An extremely fast and configurable "meta" linter that brings dozens of different linters under one roof. It has become the industry standard for enforcing code standards in Go projects.
  • gopls - The official Language Server Protocol implementation developed by the Go team. It provides features like auto-completion, go-to-definition, and real-time error analysis in editors like VS Code, GoLand, and Vim.
  • gofmt - The tool that comes with Go's standard library, which automatically formats Go code according to the standard format. goimports is a superset of gofmt that also organizes import blocks.
  • gosec - A static analysis tool that scans Go source code to detect known security vulnerabilities and common mistakes.
  • revive - A linter that is faster, more configurable, and more extensible than golint. It offers high performance, especially in CI/CD pipelines.
  • delve - The most popular and powerful full-featured debugger for the Go programming language.
  • air - A live reload tool that automatically restarts the application when it detects a change in the code files. It incredibly speeds up the web development process.
  • gops - A tool used to list currently running Go processes and get diagnostic information about them, such as memory and goroutines.
  • testcontainers-go - A library that automates test environments by programmatically creating and managing Docker containers (PostgreSQL, Redis, Kafka, etc.) for integration tests.
  • GoMock - A standard framework used to isolate dependencies in unit tests by generating mock implementations from interfaces.
  • gofakeit - A library that makes it easy to generate random and fake data (name, address, credit card, etc.) for tests.
  • goreleaser - A fantastic automation tool that compiles your Go projects for different operating systems and architectures, archives them, creates release notes, and publishes them to platforms like GitHub.
  • gox - A simple, parallel-running cross-compilation tool for Go.
  • swaggo/swag - A tool that automatically generates Swagger 2.0 / OpenAPI documentation from Go code comments.
  • oapi-codegen - A tool that generates Go server boilerplate and client code from an OpenAPI 3 specification. Ideal for design-first APIs.
  • wire - A compile-time dependency injection tool that is automatic and less prone to errors.
  • go-callvis - A tool that interactively visualizes the call graph of your Go program. Useful for understanding large projects.
  • pprof - A profiling tool included in Go's standard library, used to analyze the CPU and memory profiles of a running application. It is usually visualized with go tool pprof.

Tutorials

๐Ÿ“š Beginner and General Tutorials

๐Ÿ”ง Web Development

๐Ÿ—ƒ๏ธ Database & Cache

๐Ÿ› ๏ธ Advanced, Performance, Security

๐ŸŽฎ Games and Graphics

๐Ÿ“ฆ Architectures & Design Patterns

๐Ÿ‘จโ€๐Ÿ’ป Learning Platforms

๐Ÿงฉ Code Snippets & Examples


๐ŸŽฅ YouTube & Video Content


๐Ÿ‘ฅ Go for Developers of Other Languages

Communities

  • Go Forum - The official forum for the Go community.
  • Gophers Slack - The largest Slack channel for Go developers.

Contributing

Your contributions and suggestions are always welcome! Please follow these steps:

  1. Fork this project.
  2. Create a new branch with a name like feature/new-awesome-thing.
  3. Make your changes and Commit them (git commit -m 'feat: Add a new awesome library').
  4. Push your branch (git push origin feature/new-awesome-thing).
  5. Open a Pull Request.
  6. Up A Reddit.

About

awesome golang

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •