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
I believe I found a bug with how gosimports removes unused imports. If the package name doesn't match the name of the directory a package is imported from, gosimports will mistakenly think it is unused and remove it.
Example:
File being imported:
// project/foo/test.gopackage foobar // NOTE: package name is "foobar", but directory is "foo"funcTest() { ... }
Thanks for putting together this utility!
I believe I found a bug with how
gosimports
removes unused imports. If the package name doesn't match the name of the directory a package is imported from,gosimports
will mistakenly think it is unused and remove it.Example:
File being imported:
Source file:
gosimports
will incorrectly remove this import:However, if I manually name the import,
gosimports
will keep the import as desired.The text was updated successfully, but these errors were encountered: