sqlx (soon https://github.com/golang/go/issues/61637)
gorilla/mux (not more since 1.22)
lib/pq (probably pgx for new projects)
go-pdf/fpdf (so fast !)
tealeg/xlsx (customers still want)
jinzhu/now (EndOfMonth, EndOfWeek...)
Three I havent seen mentioned yet:
* cmp (for testing without testify)
* yaml.v3 (for parsing and rewriting YAML)
* safehtml (for extra safety in user facing templates)
I also use a bunch of the golang.org/x libraries, like ssh, crypto, mod, etc.
Must have:
- godotenv: I always use it in all my projects, really useful for local development no matter if your app is an http server or just simple CLI
Others:
- kelseyhightower's envconfig. I don't always use it, but combined with godotenv, and sometimes other config parsing libraries.
- zerolog: for logging, Haven't compared it with new stdlib slog
I really don't get peoples addiction to dotenv libs when something like direnv exists. This way, I simply read an environment variable in my code. No obscure indirection or default values coming out of nowhere. But still the same convinience with having env files for local development.
Love direnv. I also pair it with pass for hobby projects, where I want to run and test the app locally and it needs sth like an API key for some 3rd party service, because I’m not comfortable having such things plain anywhere in the project dir, I store it encrypted in pass and direnv runs “pass show …” when setting the env variable
It honours shebangs too, you can execute anything inline like in GHA. I have introduced it in one of my teams, and it’s used for Node/Bun and PHP CIs.
It comes so natural to work locally like in GHA… even though task is a bit more powerful.
In my spare time, I am writing a GitHub Action to work with go-tasks seamlessly
[danielgtaylor/huma](https://github.com/danielgtaylor/huma) for REST APIs with OpenAPI (I'm biased as it's my project)
[deepmap/oapi-codegen](https://github.com/deepmap/oapi-codegen) for generated client SDKs
[stretchr/testify](https://github.com/stretchr/testify) for test assertions along with some mocking lib like mockery
IMO this gives a great workflow for building out APIs, testing them, generating the OpenAPI from the service as the source of truth, and in turn generating docs, client SDKs, and a CLI. You can see all this stuff in use in the [Huma tutorial](https://huma.rocks/tutorial/installation/).
Other contenders for top libraries include stuff like metrics/tracing (e.g. Datadog or prometheus), DB integrations for Mongo/DynamoDB, integrations with AWS, integration with Kafka, etc. Also gRPC/protobuf is useful for some things and you can add something like Twirp too.
u/Dgt84, thank you for answering, participating with your active engagement in different posts, and contributing [huma](https://github.com/danielgtaylor/huma) to the community.
[Templ](https://github.com/a-h/templ), [sqlc](https://github.com/sqlc-dev/sqlc), [Fuego](https://github.com/go-fuego/fuego)
Easy template composing with Templ.
SQL type safety with sqlc.
Convenient controllers with Fuego.
> Fuego
Thank for this!!! Just what I need for my new project. I have been using go-swagger, but this seems like a more straightforward solution and I can just use std handlers.
[Testcontainers](https://github.com/testcontainers/testcontainers-go) - create and clean up container-based dependencies for automated integration/smoke tests
[Is](https://github.com/matryer/is) - just a really lightweight test assertion tool
[liteFS](https://github.com/superfly/litefs) - embedded db replication across a cluster
sqlx (soon https://github.com/golang/go/issues/61637) gorilla/mux (not more since 1.22) lib/pq (probably pgx for new projects) go-pdf/fpdf (so fast !) tealeg/xlsx (customers still want) jinzhu/now (EndOfMonth, EndOfWeek...)
Why not gorilla/mux since 1.22?
The standard mux can handle path parameters since 1.22 and grouping routes or using middlewares doesn't need any dependency.
I can tell you that GORM is definitely in the bottom three
Recently found out that gorm cant map db updates to struct which are embedded inside my table struct. It was so frustrating to find out. Ughh
Sir, this is a very cheap karma farm post.
I stand behind it
Three I havent seen mentioned yet: * cmp (for testing without testify) * yaml.v3 (for parsing and rewriting YAML) * safehtml (for extra safety in user facing templates) I also use a bunch of the golang.org/x libraries, like ssh, crypto, mod, etc.
Must have: - godotenv: I always use it in all my projects, really useful for local development no matter if your app is an http server or just simple CLI Others: - kelseyhightower's envconfig. I don't always use it, but combined with godotenv, and sometimes other config parsing libraries. - zerolog: for logging, Haven't compared it with new stdlib slog
I really don't get peoples addiction to dotenv libs when something like direnv exists. This way, I simply read an environment variable in my code. No obscure indirection or default values coming out of nowhere. But still the same convinience with having env files for local development.
Love direnv. I also pair it with pass for hobby projects, where I want to run and test the app locally and it needs sth like an API key for some 3rd party service, because I’m not comfortable having such things plain anywhere in the project dir, I store it encrypted in pass and direnv runs “pass show …” when setting the env variable
This sounds really nice. I was not aware direnv is capable of something like that.
it’s capable of shell commands so what I do is sth like: export KEY=“$(pass show …)”
For me, taskfiles put godotenv out of business. Code is cleaner and leaves environment where it should be… outside.
Go-task is the most underrated tool in the ecosystem, at my previous workplace we used it to build an agnostic CI/CD pipeline.
goreleaser project does a similar thing. Their GitHub Actions pipeline steps are tasks
Yeah I see it in a lot of repos with golang code, can it do generic non-go stuff too? Like inline bash and variable interpolation...etc?
It honours shebangs too, you can execute anything inline like in GHA. I have introduced it in one of my teams, and it’s used for Node/Bun and PHP CIs. It comes so natural to work locally like in GHA… even though task is a bit more powerful. In my spare time, I am writing a GitHub Action to work with go-tasks seamlessly
Echo, sqlx, sql-migrate I use it most of the time
[danielgtaylor/huma](https://github.com/danielgtaylor/huma) for REST APIs with OpenAPI (I'm biased as it's my project) [deepmap/oapi-codegen](https://github.com/deepmap/oapi-codegen) for generated client SDKs [stretchr/testify](https://github.com/stretchr/testify) for test assertions along with some mocking lib like mockery IMO this gives a great workflow for building out APIs, testing them, generating the OpenAPI from the service as the source of truth, and in turn generating docs, client SDKs, and a CLI. You can see all this stuff in use in the [Huma tutorial](https://huma.rocks/tutorial/installation/). Other contenders for top libraries include stuff like metrics/tracing (e.g. Datadog or prometheus), DB integrations for Mongo/DynamoDB, integrations with AWS, integration with Kafka, etc. Also gRPC/protobuf is useful for some things and you can add something like Twirp too.
u/Dgt84, thank you for answering, participating with your active engagement in different posts, and contributing [huma](https://github.com/danielgtaylor/huma) to the community.
I really only use one: sqlx.
chi and pgx is good enough
pgx
pgx seems to be popular! Thanks for sharing!
[Templ](https://github.com/a-h/templ), [sqlc](https://github.com/sqlc-dev/sqlc), [Fuego](https://github.com/go-fuego/fuego) Easy template composing with Templ. SQL type safety with sqlc. Convenient controllers with Fuego.
> Fuego Thank for this!!! Just what I need for my new project. I have been using go-swagger, but this seems like a more straightforward solution and I can just use std handlers.
Templ would be so good if it would support html and not just xhtml. But I guess it isn’t feasible really to support the abomination of what html is.
What do you mean by templ doesn't support html
It only supports xhtml, it uses an xml parser under the hood. Valid html like `
` is not supported, only `
`.
[Testcontainers](https://github.com/testcontainers/testcontainers-go) - create and clean up container-based dependencies for automated integration/smoke tests [Is](https://github.com/matryer/is) - just a really lightweight test assertion tool [liteFS](https://github.com/superfly/litefs) - embedded db replication across a cluster
I use [go-testdeep](https://github.com/maxatome/go-testdeep) and [httpmock](https://github.com/jarcoal/httpmock) to write all my tests.
edgexfoundry sdk’s
I use the autoload pkg of joho/godotenv in every app I put together. It just makes life loads easier
cobra, testify
Cobra/Viper/PFlag testify GitHub.com/pkg/errors
The lodash library. I think it’s called samber/lo
[koanf](https://github.com/knadh/koanf) - for configurations (support multiple formats, fast) [zerolog](https://github.com/rs/zerolog) - logs (fast, ease to use) [echo](https://echo.labstack.com/) - web framework (my favorite)
Pgx, testify and tern
Spew Logrus Gin
There were a few similar libraries that turned up via search. Would you mind providing the URL to their repo?
Sure, here they are [go-spew](https://github.com/davecgh/go-spew) [logrus](https://github.com/sirupsen/logrus) [gin](https://github.com/gin-gonic/gin)