migrate icon indicating copy to clipboard operation
migrate copied to clipboard

gofmt

Open whilei opened this issue 6 years ago • 2 comments

Just ran

gofmt -w .

on the project root. That's all.

https://blog.golang.org/go-fmt-your-code


I made this PR with a project going on over at https://github.com/rotblauer/gofmt-att, and it's definitely a work in progress. So if I got something wrong, or this is annoying at all, please file an issue over there and we'll sort it out.

whilei avatar Jun 16 '18 22:06 whilei

How about we run gofmt in CI to make sure that we adhere to this forever?

JensRantil avatar Jun 19 '18 05:06 JensRantil

My only adviso for that is https://golang.org/doc/go1.10#gofmt

Note that these kinds of minor updates to gofmt are expected from time to time. In general, we recommend against building systems that check that source code matches the output of a specific version of gofmt. For example, a continuous integration test that fails if any code already checked into a repository is not “properly formatted” is inherently fragile and not recommended.

If multiple programs must agree about which version of gofmt is used to format a source file, we recommend that they do this by arranging to invoke the same gofmt binary. For example, in the Go open source repository, our Git pre-commit hook is written in Go and could import go/format directly, but instead it invokes the gofmt binary found in the current path, so that the pre-commit hook need not be recompiled each time gofmt changes.

whilei avatar Jun 19 '18 09:06 whilei