-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
I get "File is not goimports
-ed" for a valid import
#1462
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
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
I’ve seen this before and we need to investigate. In the meantime, you can fix this with the fixer: golangci-lint run --fix |
here is my file: package main
import (
"os"
"github.com/sirupsen/logrus"
prefixed "github.com/x-cray/logrus-prefixed-formatter"
)
var log = logrus.New()
func init() {
log.Formatter = new(prefixed.TextFormatter)
log.Level = logrus.DebugLevel
}
func main() {
log.WithFields(logrus.Fields{
"prefix": "main",
"animal": "walrus",
"number": 8,
}).Debug("Started observing beach")
log.WithFields(logrus.Fields{
"prefix": "sensor",
"temperature": -4,
}).Info("Temperature changes")
os.Exit(1)
} And here is the golangci-lint output: 21-01-10 19:10 % golangci-lint run -v --no-config --disable-all -E goimports main.go
INFO [lintersdb] Active 1 linters: [goimports]
INFO [loader] Go packages loading at mode 7 (compiled_files|files|name) took 360.298488ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 218.741µs
INFO [linters context/goanalysis] analyzers took 0s with no stages
INFO [runner] processing took 5.759µs with stages: max_same_issues: 2.089µs, nolint: 1.494µs, skip_dirs: 262ns, max_from_linter: 223ns, path_shortener: 148ns, identifier_marker: 141ns, cgo: 139ns, diff: 136ns, source_code: 135ns, path_prettifier: 135ns, skip_files: 130ns, uniq_by_line: 128ns, autogenerated_exclude: 125ns, filename_unadjuster: 119ns, max_per_file_from_linter: 67ns, exclude: 59ns, sort_results: 59ns, severity-rules: 57ns, exclude-rules: 57ns, path_prefixer: 56ns
INFO [runner] linters took 624.048µs with stages: goimports: 567.261µs
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 5 samples, avg is 73.3MB, max is 73.3MB
INFO Execution took 376.854694ms |
@avishaik Do you still have this issue? If no, then let's close |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
For poor souls like me getting this error (right on "package" instruction) in JetBrains IDE with Go linter plugin on Windows for completely valid imports, check line separators of file. I believe diff tool needed for goimports linter have problems with CRLF. After converting to LF all was fine. |
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I get a lint error:
For the following import:
The above result is after goimport for the file, and still the linter give this error.
The text was updated successfully, but these errors were encountered: