We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go version
$ go version go version go1.10.3 darwin/amd64
when i have code like this:
var extractAllowedHeadersToModelServerTests = []struct { desc string incomingHeaders map[string]string allowedHeadersToModelServer map[string]struct{} expect []string }{ { desc: "Test case: HTTP request no headers allowed", incomingHeaders: map[string]string{ "key_1": "value_1", }, allowedHeadersToModelServer: map[string]struct{}{}, expect: []string{}, }, }
i tested with gofmt it doesn't complain, but with goimports it will complain that .go:1::warning: file is not goimported (goimports)
gofmt
goimports
.go:1::warning: file is not goimported (goimports)
then i run the goimports -w path_to_above_source_file.go, and find out it is complaining the expect: []string{}, line, and it formats it to:
goimports -w path_to_above_source_file.go
expect: []string{},
incomingHeaders: map[string]string{ "key_1": "value_1", }, allowedHeadersToModelServer: map[string]struct{}{}, expect: []string{},
looks like gofmt and goimports conflict with each other on the code style formatting?
The text was updated successfully, but these errors were encountered:
This is almost always due to version skew between gofmt and goimports. Try updating goimports (go get -u golang.org/x/tools/cmd/goimports).
Sorry, something went wrong.
I just updated the go version go 1.10.3 -> 1.11.4, and gofmt starts complaining also :)
go 1.10.3 -> 1.11.4
Closing as problem solved.
No branches or pull requests
What version of Go are you using (
go version
)?when i have code like this:
i tested with
gofmt
it doesn't complain, but withgoimports
it will complain that.go:1::warning: file is not goimported (goimports)
then i run the
goimports -w path_to_above_source_file.go
, and find out it is complaining theexpect: []string{},
line, and it formats it to:looks like
gofmt
andgoimports
conflict with each other on the code style formatting?The text was updated successfully, but these errors were encountered: