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
This was an intentional change.
We decided that goimports was adding a local alias in cases where the name was easy to determine from a simple rule, in cases where the base name is not valid as a package name.
RIght now the rules are, any trailing path fragments that look like versions are dropped.
The last remaining fragment is examined, if it starts with go- then that bit is dropped.
If the remains contains a character that would not be valid in an identifier, then only the part before that character is considered.
If what we have left matches the internal name, then no local alias is added, otherwise one is.
@ianthehat
As you mentioned, goimports added many aliases but it affects many our source code and it's not readable for us because we are used to previous code without alias.
Is there any way to prevent alias addition functionality??
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
After
go get -u golang.org/x/tools/cmd/goimports
.Having a
file.go
withI'm running
goimports -w file.go
.What did you expect to see?
What did you see instead?
Not long ago
goimports
started adding aliases in case package name differs from import path, with recent update that seem to be reverted.The text was updated successfully, but these errors were encountered: