-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
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
chore: add goimports #20651
chore: add goimports #20651
Conversation
Failure before running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raging against the machine
b4520c7
to
9b78159
Compare
It turns out Manually fixed the grouping for some files. |
@@ -136,7 +136,7 @@ func (c *TagValueSeriesIDCache) Put(name, key, value []byte, ss *tsdb.SeriesIDSe | |||
|
|||
// No map for the measurement - first tag key for the measurement. | |||
c.cache[string(name)] = map[string]map[string]*list.Element{ | |||
string(key): map[string]*list.Element{string(value): listElement}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is the gofmt -s
- I guess nobody ran a make fmt
recently
9b78159
to
781fa0e
Compare
HAS_FMT_ERR=0 | ||
# For every Go file in the project, excluding vendor... | ||
for file in $(go list -f '{{$dir := .Dir}}{{range .GoFiles}}{{printf "%s/%s\n" $dir .}}{{end}}' ./...); do | ||
|
||
for file in $(go list -f '{{$dir := .Dir}}{{range .GoFiles}}{{printf "%s/%s\n" $dir .}}{{end}}{{range .TestGoFiles}}{{printf "%s/%s\n" $dir .}}{{end}}{{range .IgnoredGoFiles}}{{printf "%s/%s\n" $dir .}}{{end}}{{range .CgoFiles}}{{printf "%s/%s\n" $dir .}}{{end}}' ./... ); do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even more fun - we were not doing format checking on tests, cgo files, or ignored files like tools.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My GoLand linter will be very happy after this change
# ... if file does not contain standard generated code comment (https://golang.org/s/generatedcode)... | ||
if ! grep -Exq '^// Code generated .* DO NOT EDIT\.$' $file; then | ||
FMT_OUT="$(gofmt -l -d -e $file)" # gofmt exits 0 regardless of whether it's formatted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we keep the gofmt
call if goimports
only checks imports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
goimports
also does formatting . The only thing it is missing is the -s
argument to gofmt
- do we want to block PR's on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also golang/go#21476
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note we weren't blocking on -s
before.
Closes #