How to start a Go project in 2023
41–50 of 205 posts
Re: How to start a Go project in 2023
#42Things I can't live without in a new Go project in no particular order: - https://github.com/golangci/golangci-lint - meta-linter - https://goreleaser.com - automate release workflows - https://magefile.org - build tool that can version your tools - https://godoc.org/github.com/ory/dockertest/v3 - run containers for e2e testing - https://github.com/ecordell/optgen - generate functional options - https://golang.org/x/…
Are there boilerplates that include things like this? (I’m coming from the JS/TS world)
Might be a little out of date.
Re: How to start a Go project in 2023
#43Re: How to start a Go project in 2023
#44Re: How to start a Go project in 2023
#45How to start a new Go project: go mod init mymodule Go's default toolchain is fine, everything else is optional. Some questionable advice in the article: - Vendoring dependencies using "go mod vendor" is not a good default workflow - it bloats the repo, the checked in code is impossible to review, and is generally a pain to keep up to date. Don't, unless you really have to. - There's no point in stripping a binary or…
vendoring is a bit of project smell, but for large teams it removes the confusion of who has what version of a dependency unfortunately most teams don't schedule a periodic `go mod tidy` so you just end up with ancient deps most people never read the code of the deps they pull in, so I don't think vendoring provides any security assurances
Re: How to start a Go project in 2023
#46[flagged]
Re: How to start a Go project in 2023
#47I see the note in the article around using -ldflags="-s -w" - is there any other useful tool for binary size analysis/reduction? I was surprised when my binary size doubled when incorporating the K8s client package to get a secret; just using the HTTP secrets API manually without referencing the client package shrank the size by many MB. It would be nice to find similar opportunities for size reduction that aren’t as…
# show the impact of cutting any package
goda cut ./...:all
which prints a sorted ASCII table with stats like 'size:4.4MB loc:134171' for each package, which is an estimate the savings you'd get if you eliminated that package from your binary. That is a great way to see what is unexpectedly large compared to its value.goda has a bunch of other capabilities around dependency analysis, and was written by long-time Go contributor Egon Elbre. The examples in the README are the best way to get started after 'go install github.com/loov/goda@latest'.
Re: How to start a Go project in 2023
#48[flagged]
Re: How to start a Go project in 2023
#49Re: How to start a Go project in 2023
#50[flagged]
What's "most modern languages"? Go is better than Python's native tooling (only Poetry and other similar 3rd party tools compare). Javascript I find unruly and fragmented. "Modern" C++ is still a nightmare. Java I haven't touched but I don't exactly hear rave reviews or angry rants about, so I expect it's middling. Rust, scala, and haskell are definitely better experiences, but they are definitely in the minority in…
Exactly the scale I had in mind, thanks. When I saw 'go get ' rather than dependencies added to the equivalent of a Gemfile / cargo / pom file it had concerns.