What are your favorite packages to use?

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • chi

    lightweight, idiomatic and composable router for building Go HTTP services

  • https://github.com/derision-test/go-mockgen for the best mocks Ive ever had in Go https://github.com/go-chi/chi for HTTP routing

  • logrus

    Structured, pluggable logging for Go.

  • logrus for logging. It's slower than zerolog but I've been used it for so long, so if performance doesn't really matter (e.g. simple CLI) I still prefer to use it.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • zerolog

    Zero Allocation JSON Logger

  • logrus and, more recently, zerolog for logging

  • spew

    Implements a deep pretty printer for Go data structures to aid in debugging

  • go-spew : Really helpful to pretty print user defined data structures, makes debugging a lot easier.

  • Gin

    Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.

  • This has been fixed in Gin v1.7.2.

  • pgx

    PostgreSQL driver and toolkit for Go

  • Here is link number 1 - Previous text "PGX"

  • go-json

    Fast JSON encoder/decoder compatible with encoding/json for Go

  • go-json for encoding/decoding

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • aconfig

    Simple, useful and opinionated config loader.

  • urfave/cli

    A simple, fast, and fun package for building command line apps in Go (by urfave)

  • pggen

    Generate type-safe Go for any Postgres query. If Postgres can run the query, pggen can generate code for it.

  • Agree with your choices, except go-json which I never tried. pggen is fantastic. Love that library. The underlying driver, pgx, is also really well written.

  • go-mockgen

  • https://github.com/derision-test/go-mockgen for the best mocks Ive ever had in Go https://github.com/go-chi/chi for HTTP routing

  • sqlf

    sqlf generates parameterized SQL statements in Go, sprintf style

  • https://github.com/keegancsmith/sqlf for building parameterized SQL queries

  • protoactor-go

    Proto Actor - Ultra fast distributed actors for Go, C# and Java/Kotlin

  • https://github.com/AsynkronIT/protoactor-go for actor model framework (situational)

  • GJSON

    Get JSON values quickly - JSON parser for Go

  • I love https://github.com/tidwall/gjson and https://github.com/tidwall/sjson for fast and frictionless json reading and editing. It makes life so much easier for cases where you don't want to model a tree of nightmare-ish API responses, like Elasticsearch.

  • sjson

    Set JSON values very quickly in Go

  • I love https://github.com/tidwall/gjson and https://github.com/tidwall/sjson for fast and frictionless json reading and editing. It makes life so much easier for cases where you don't want to model a tree of nightmare-ish API responses, like Elasticsearch.

  • go-sdk

    A composable toolbox of libraries to build everything from CLIs to enterprise applications. (by blend)

  • This is probably not popular approach on here, but we maintain a public version of our internal go monorepo sdk package as an open source repo on github: https://github.com/blend/go-sdk, and I'll use this for personal stuff as well.

  • errors

    Discontinued Simple error handling primitives

  • https://github.com/pkg/errors is a must-have prior to the Go2 error proposals landing.

  • godotenv

    A Go port of Ruby's dotenv library (Loads environment variables from .env files)

  • https://github.com/joho/godotenv for loading env vars from a file gets used a lot here.

  • httprouter

    A high performance HTTP request router that scales well

  • httprouter for routing. Several years ago (5 years ago maybe) when I started using Go, I always tried to use the best and fastest packages and this package boasts itself as the fastest router for Go. Fast forward to today, I'm not sure if it still the fastest around, but it's stable and I've never had issues with it, so I keep using it.

  • Testify

    A toolkit with common assertions and mocks that plays nicely with the standard library

  • testify for testing. I like it since it make the testing codes shorter and tidy.

  • cobra

    A Commander for modern Go CLI interactions

  • cobra for CLI. It's easy to use and I've been using it for so long I don't have any plan to change it.

  • sqlx

    general purpose extensions to golang's database/sql

  • sqlx which make working with database painless. It's really vital for my job since as an ordinary developer my jobs often revolved on creating CRUD apps. It also uses SQL query, so I don't have to learn any ORMs.

  • decimal

    Arbitrary-precision fixed-point decimal numbers in Go

  • decimal, one of the first Go library that created to work with decimal and monetary value.

  • qamel

    Simple QML binding for Go

  • qamel, simple QML binding for Go. Before pandemic I often use it for creating simple GUI apps for my clients or friends. It's features are limited, only works for Windows and Linux (though there is PR for ARM devices which I haven't able to check) but it's good enough for my case.

  • dom

    Package for access and manipulate DOM element in HTML file (by go-shiori)

  • dom, package for manipulating HTML document with APIs that kinda similar with DOM manipulation in JS. I use it whenever I need to scrape data from websites.

  • dbgen

    Discontinued Generate database code from SQL files, using sqlx as its base library

  • dbgen, a simple package for generating database codes for MySQL and MariaDB. As I said before, my job mostly on CRUDs and it's quite a pain to write database codes in Go using sqlx as its base. For each database operation I need to do at least three operations:

  • koanf

    Simple, extremely lightweight, extensible, configuration management library for Go. Support for JSON, TOML, YAML, env, command line, file, S3 etc. Alternative to viper.

  • https://github.com/knadh/koanf for config management. Readme contains why it's a good alternative to viper.

  • ulid

    Universally Unique Lexicographically Sortable Identifier (ULID) in Go

  • oklog/ulid to generate IDs. coreos/go-oidc for validating JWTs I get from auth. google/go-cmp for comparing structs in tests (unless the project is already using Testify). spf13/pflag because life's too short for Go's flag handling. getkin/kin-openapi for validating reqests/responses against my OpenAPI spec (in tests).

  • go-oidc

    A Go OpenID Connect client.

  • oklog/ulid to generate IDs. coreos/go-oidc for validating JWTs I get from auth. google/go-cmp for comparing structs in tests (unless the project is already using Testify). spf13/pflag because life's too short for Go's flag handling. getkin/kin-openapi for validating reqests/responses against my OpenAPI spec (in tests).

  • go-cmp

    Package for comparing Go values in tests

  • oklog/ulid to generate IDs. coreos/go-oidc for validating JWTs I get from auth. google/go-cmp for comparing structs in tests (unless the project is already using Testify). spf13/pflag because life's too short for Go's flag handling. getkin/kin-openapi for validating reqests/responses against my OpenAPI spec (in tests).

  • pflag

    Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

  • oklog/ulid to generate IDs. coreos/go-oidc for validating JWTs I get from auth. google/go-cmp for comparing structs in tests (unless the project is already using Testify). spf13/pflag because life's too short for Go's flag handling. getkin/kin-openapi for validating reqests/responses against my OpenAPI spec (in tests).

  • kin-openapi

    OpenAPI 3.0 (and Swagger v2) implementation for Go (parsing, converting, validation, and more)

  • oklog/ulid to generate IDs. coreos/go-oidc for validating JWTs I get from auth. google/go-cmp for comparing structs in tests (unless the project is already using Testify). spf13/pflag because life's too short for Go's flag handling. getkin/kin-openapi for validating reqests/responses against my OpenAPI spec (in tests).

  • gogo-factory

  • Are there people seek a fixture replacement package like factory_bot (a ruby gem)? I build a similar package (gogo-factory). It is helpful to setup test data.

  • migrate

    Database migrations. CLI and Golang library.

  • For my simple case i just wrote the migrations as queries in my test code. But I'm pretty sure you could use go-migrate for that

  • swag

    Automatically generate RESTful API documentation with Swagger 2.0 for Go.

  • Swag Swagger doc generator

  • zap

    Blazing fast, structured, leveled logging in Go.

  • Zap Levelled logging

  • ginkgo

    A Modern Testing Framework for Go

  • Ginkgo Behavioural test framework

  • jsoniter

    A high-performance 100% compatible drop-in replacement of "encoding/json" (by json-iterator)

  • jsoniter for low level access to JSON encode and decode

  • Task

    A task runner / simpler Make alternative written in Go

  • Go Task A simple task runner which is cleaner IMHO than using Makefiles (opinionated but works for me)

  • goreman

    foreman clone written in go language

  • Goreman A handy little process runner I find useful for various things

  • direnv

    unclutter your .profile

  • Direnv Very useful for maintaining environments per directory

  • athens

    A Go module datastore and proxy (by gomods)

  • Athens A self hosted Go module proxy which has saved our asses more than once.

  • bqb

    BQB is a lightweight and easy to use query builder that works with sqlite, mysql, mariadb, postgres, and others.

  • bqb for query building. Used to use squirrel, but performance and complexity lead me to make bqb.

  • gqlgen

    go generate based graphql server library

  • gqlgen for GraphQL services. After trying several packages, gqlgen has been the most stable and easy to use.

  • gopherjs

    A compiler from Go to JavaScript for running Go code in a browser

  • gopherjs has been great with a personal experiment to implement a virtual dom framework within Go.

  • go-formatter

    A curated list of awesome Go frameworks, libraries and software

  • Also recommend the Awesome Go list.

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts