You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.PHONY: fmt
fmt:
go get golang.org/x/tools/cmd/goimports
./bin/goimports -w .
go fmt ./...
I've now substituted that by:
.PHONY: fmt
fmt:
go get mvdan.cc/gofumpt
go get mvdan.cc/gofumpt/gofumports
./bin/gofumports -w .
./bin/gofumpt ./...
When I run make fmt, I get this output:
$ make fmt
go get mvdan.cc/gofumpt
go: finding mvdan.cc/gofumpt latest
go get mvdan.cc/gofumpt/gofumports
go: finding mvdan.cc/gofumpt/gofumports latest
go: finding mvdan.cc/gofumpt latest
./bin/gofumports -w .
./bin/gofumpt ./...
stat ./...: no such file or directory
Makefile:26: recipe for target 'fmt' failed
make: *** [fmt] Error 2
It appears however as if gofumpt did reformat quite a bunch of files nonetheless, but still it should not generate an error.
The text was updated successfully, but these errors were encountered:
Freeaqingme
changed the title
Incompatibility with 'go fmt'
Incompatibility with 'go fmt' in loading files
Jun 29, 2019
Perhaps the README is unclear - this is a gofmt replacement, not a go fmt replacement. go fmt works on packages, while gofmt works on files and directories.
A drop-in replacement for go fmt would be quite a lot of work, as I'd have to copy a huge chunk of code from the go tool. It's also a bit unnecessary, because I believe that go fmt ends up calling gofmt under the hood.
You likely want to do gofumpt -w . instead just like you do with goimports. Note that running the two tools is a bit redundant, though - gofumports -w . should be everything you need.
My Makefile used to say do this:
I've now substituted that by:
When I run
make fmt
, I get this output:It appears however as if gofumpt did reformat quite a bunch of files nonetheless, but still it should not generate an error.
The text was updated successfully, but these errors were encountered: