-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Milestone
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version go1.9 darwin/amd64
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
What did you do?
run goimports -d .
It seems to not work as expected when there is a line with a comment
What did you expect to see?
Having in test.go
package main
var (
translationItemResponseChannel chan string
version string
environment string
countryCode string
// CacheControlMaxAge in minutes
CacheControlMaxAge int
anotherVarToFix string
)
goimports should fix it and align the types like this
$ goimports -d test.go
diff -u test.go.orig test.go
--- test.go.orig 2017-09-26 17:02:52.000000000 +0200
+++ test.go 2017-09-26 17:02:52.000000000 +0200
@@ -3,8 +3,8 @@
var (
translationItemResponseChannel chan string
version string
- environment string
+ environment string
countryCode string
// CacheControlMaxAge in minutes
- CacheControlMaxAge int
- anotherVarToFix string
+ CacheControlMaxAge int
+ anotherVarToFix string
)
What did you see instead?
But if there is a commented line in between, weird things happen
$ goimports -d test.go
diff -u test.go.orig test.go
--- test.go.orig 2017-09-26 17:00:40.000000000 +0200
+++ test.go 2017-09-26 17:00:40.000000000 +0200
@@ -3,9 +3,9 @@
var (
translationItemResponseChannel chan string
version string
- environment string
+ environment string
countryCode string
// CacheControlMaxAge in minutes
CacheControlMaxAge int
- anotherVarToFix string
+ anotherVarToFix string
)
Reactions are currently unavailable