3 ms·
Let's say you comment out some line of code in go and go complains about an unused import. You run goimports and it removes the import. If you uncomment out tha
by hehheh 10y ago
Let's say you comment out some line of code in go and go complains about an unused import. You run goimports and it removes the import. If you uncomment out that line of code and re-run goimports, will goimports automatically re-add the correct import statement every time?
- ngrilly 10y ago> Let's say you comment out some line of code in go and go complains about an unused import. If you setup your text editor to execute goimports on save, it won't happen, because the import will already be removed. > If you uncomment out that line of code and re-run goimports, will goimports automatically re-add the correct import statement every time? Most of the time, yes, but not every time. It works well for the standard library and when the last segment of the package name is enough to identify the package.