Live data from Hacker News

How to start a Go project in 2023

boyter.org

1–10 of 205 posts

Re: How to start a Go project in 2023

#2
The article mentions GOW[0] for a file watcher. If anyone is looking for a non-go specific one, I've really enjoyed reflex[1]. Makes it super easy to reload different parts of a project based on what type of file has changed.

[0]https://github.com/mitranim/gow [1]https://github.com/cespare/reflex

Re: How to start a Go project in 2023

#3
post #2

The article mentions GOW[0] for a file watcher. If anyone is looking for a non-go specific one, I've really enjoyed reflex[1]. Makes it super easy to reload different parts of a project based on what type of file has changed. [0] https://github.com/mitranim/gow [1] https://github.com/cespare/reflex

how about watchman? I use that one. https://manpages.ubuntu.com/manpages/jammy/man1/watchman.1.h...

Re: How to start a Go project in 2023

#4
Things 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/tools/cmd/stringer - generate String()

- https://mvdan.cc/gofumpt - stricter gofmt

- https://github.com/stretchr/testify - test assertion library

- https://github.com/rs/zerolog - logging

- https://github.com/spf13/cobra - CLI framework

FWIW, I just lifted all the tools we use for https://github.com/authzed/spicedb

We've also written some custom linters that might be useful for other folks: https://github.com/authzed/spicedb/tree/main/tools/analyzers

Re: How to start a Go project in 2023

#5
well written post!

one minor thing: I've skipped using build tags for integration tests because those tests will be out of sync one day with your main code, even with Goland (?).

Instead I use the usual test and check if an environment variable is set, if not, then

    t.Skipf("env var %q not set, skipping integration test",envVarName)
or you can use an additional CLI flag, e.g. in `feature_test.go` write

    func init() { flagIntegration := flag.Bool("test.integration",false,"run int tests") }
then

    $ go test -v -test.integration

Re: How to start a Go project in 2023

#7
post #2

The article mentions GOW[0] for a file watcher. If anyone is looking for a non-go specific one, I've really enjoyed reflex[1]. Makes it super easy to reload different parts of a project based on what type of file has changed. [0] https://github.com/mitranim/gow [1] https://github.com/cespare/reflex

Mentioned in reflex's competition section I am a huge fan of entr

https://github.com/eradman/entr

Re: How to start a Go project in 2023

#8
post #5

well written post! one minor thing: I've skipped using build tags for integration tests because those tests will be out of sync one day with your main code, even with Goland (?). Instead I use the usual test and check if an environment variable is set, if not, then t.Skipf("env var %q not set, skipping integration test",envVarName) or you can use an additional CLI flag, e.g. in `feature_test.go` write func init() { f…

> integration tests because those tests will be out of sync one day with your main code

What do you mean here? What would be out of sync, and what would happen if it were?

Re: How to start a Go project in 2023

#10
post #2

The article mentions GOW[0] for a file watcher. If anyone is looking for a non-go specific one, I've really enjoyed reflex[1]. Makes it super easy to reload different parts of a project based on what type of file has changed. [0] https://github.com/mitranim/gow [1] https://github.com/cespare/reflex

Since we are mentioning these, I use entr

# Makefile test: `find * -name "*.go" | entr bash -c "clear; go test ./..."`

https://eradman.com/entrproject/

Post reply on HN