How to start a Go project in 2023
BOYTER.ORG
437
195
taylorbuley
7d
Comments
@Daegalus
6d
I would like to mention Magefile. We recently have been using it over makefiles and it has been amazing. Removes more non-go dependencies. You write your files in Go, and it all works really well.
Between that, goreleaser, 2-stage dockerfiles, static binaries, etc. It all just works so well and only needs Go for most things.
Recently for actual stuff we have been using Exho, Zerolog, and fairly common libraries for most tools.
@mparnisari
7d
If your code uses goroutines i recommend https://github.com/uber-go/goleak to detect leaks
And then for GUID generation we use https://github.com/oklog/ulid instead of https://github.com/google/uuid/
@metaltyphoon
6d
Does Go allow to load an in-process profiler like the CLR (dotnet)? It’s very useful for application monitoring, e.g NewRelic, DataDog.
@Groxx
6d
Integration tests via build tags: no! Don't do this! It'll mean you don't get build failures if you break them.
Make a little test utils folder, and `t.Skip("disabled, use ENV_VAR to enable")` in integration tests. Then they're always built, always linted, always work in IDEs, you are told they exist, and told how to enable them. None of that is true with build tags.
@kylequest
6d
Cool to see that people still find "50 Shades of Go" useful :) If anybody has additional gotchas you want to share I'd love to add them!
@TurboHaskal
6d
This is how I start a Go project in 2023.
mkdir new-repo
vim new-repo/main.go
I try to stick to the stdlib as much as possible, which goes surprisingly far.
@rusl1
6d
I'm learning Go right now and these comments are really precious, so many useful respurces