-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Significant performance issues with goimports
and modules
#263
Comments
hi, thank you for the verbose description!
|
I have reproduced it myself
|
It's the issue with goimports. |
Apply https://go-review.googlesource.com/c/tools/+/132598/ as a temporary fix before a proper fix is in golang.org/x/tools
Apply https://go-review.googlesource.com/c/tools/+/132598/ as a temporary fix before a proper fix is in golang.org/x/tools
As part of this commit golang.org/x/tools was updated to 6c7e314b6563. This includes golang/tools@a2dc476 which reverted the very nice improvement to import grouping that was introduced in 0e2be20 Is there any way of getting this feature back? Having working import grouping is more important to me than keeping import comments, which was the reason for the revert upstream. |
yep, it contains bugs (described in golang/go#20818). We could merge it when it would be fixed |
Reverting fix because it's buggy, waiting for a final fix in x/tools |
The new version of goimports works 100x faster with go modules. Also it has some new features: $ git cherry -v 6c7e314b6563 92cdcd90bf52 | fgrep imports + 5bbcdc15656ef390fab5dd6e8daf95354f7171e3 imports: redesign fixImports + ee45598d2ff288037f53f9e13ae0b1a6e2165ad5 imports: create named imports for name/path mismatches (again) + 4c53570e0460bc32468f75bf9dd71c018d03bfa9 imports: ignore globals in different packages + 1d424dbce8dd500e9e449fd3ff9d0668c09e2ae1 imports: clean up customization seam + 6a3e9aa2ab7749d72d1006ee484271b4a11f96c2 imports: fix renamed sibling imports + 5f4a60f04f23ac48e0665f257413ae3eacf339be imports: fix renamed sibling imports more + bbccd8cae4a9a47e0f978e03ff4b5df88a9fde1e imports: use go/packages, support modules + d4971274fe382404aee0e8c163af974f2bf738e6 imports: don't remove imports that conflict with globals
Merged a new fix for goimports, it should work fast again |
$ git cherry --abbrev -v 8afd9cbb6cfb 66fb7fc33547 + 63b25c1 Fix typo in README (#235) + 419c929 G107 - SSRF (#236) + 145f1a0 Removed wrapping feature (#238) + ec32ce6 Support Go 1.11 (#239) + 762ff3a Allow quoted strings to be used to format SQL queries (#240) + 7f6509a Update README.md (#246) + 5f98926 Refactor Dockerfile (#245) + d3f1980 Fix false positives for SQL string concatenation with constants from another file (#247) + 64d58c2 Refactor the test code sample to support multiple files per sample + 1ecd47e bump Dockerfile golang from 1.10 to 1.11 + 027dc2b This fixes the html template when using '-fmt=html' - resolves HTML escaping issues within the template - resolves reference issues to reportInfo struct i.e. issues -> Issues, metrics -> Stats + 8c09a83 Add install.sh script + 97bc137 Add CI Installation steps and correct markdown lint errors + 3116b07 Fix typos in comments and rulelist (#256) + 443f84f Fix golint link (#263) + 4180994 Make G201 ignore CallExpr with no args (#262) + 9b966a4 add test case for strings.Builder G104 whitelist inclusion + adb4222 whitelist strings.Builder method in rule G104 + ae82798 Fix the WriteSring test by handling the error + 2695567 Build the code sample for string builder only fron Go 1.10 onwards + f14f17f Add a helper function which extracts the string parameters values of a call expression + 9b32fca Fix the bind rule to handle the case when the arguments of the net.Listen are returned by a function call + 24e3094 Extend the bind rule to handle the case when the net.Listen address in provided from a const + 72e95e8 Geneate and upload the test coverage report to codecove.io + 12400f9 Update README with the code coverage batch + 14ed63d Do not flag the unhandled errors which are explicitly ignored + f87af5f Detect the unhandled errors even though they are explicitly ignored if the 'audit: enabled' setting is defined in the global configuration (#274) + 5d33e6e Update the README with some details about the configuration file + b662615 Fix typo + a966ff7 Fix -conf example in README.md + 04ce7ba add a no-fail flag + e2752bc revert to default GOPATH if necessary (#279) - c04360f make API + 66fb7fc Replace import paths
Running
goimports
outside of theGOPATH
has a significant performance hit, off by an order of magnitude compared to other linters. No other linter seems to have any significant difference off theGOPATH
.I've run a quick benchmark against this repo after removing
.golangci.yml
for a clean configuration, with times taken from the-v
output. I've gotten similar results after repeating multiple times, and similar results using another repo.Some numbers, which seem to indicate that only
goimports
+ modules has the issue:GOPATH
golangci-lint run -v --enable-all --disable goimports ./...
golangci-lint run -v --disable-all --enable goimports ./...
golangci-lint run -v --enable-all --disable goimports ./...
golangci-lint run -v --disable-all --enable goimports ./...
golangci-lint --version
go version && go env
golangci-lint run -v --disable-all --enable goimports ./...
with no.golangci.yml
The text was updated successfully, but these errors were encountered: