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
Goimports can detect the absence of a newline at EOF, but it doesn't fix the problem with --fix flag.
# checking test.go with no newline at EOF
$ golangci-lint run --no-config --disable-all -E goimports test.gotest.go:7: File is not `goimports`-ed (goimports)} # runnin the same command with --fix flag
$ golangci-lint run -v --fix --no-config --disable-all -E goimports test.go...INFO [runner] Fix issue &result.Issue{FromLinter:"goimports", Text:"File is not `goimports`-ed", Severity:"", SourceLines:[]string{"}"}, Replacement:(*result.Replacement)(0xc000ecc930), Pkg:(*packages.Package)(0xc0001bad80), LineRange:(*result.Range)(nil), Pos:token.Position{Filename:"test.go", Offset:0, Line:7, Column:0}, HunkPos:0, ExpectNoLint:false, ExpectedNoLintLinter:""} with range {7 7} ...INFO Execution took 103.535312ms # checking test.go after the fix - the problem remains the same
$ golangci-lint run --no-config --disable-all -E goimports test.gotest.go:7: File is not `goimports`-ed (goimports)}
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.
kseniadumpling
changed the title
goimports and gofmt with --fix don't fix missing newline at EOF
goimports with --fix don't fix missing newline at EOF
Mar 30, 2023
kseniadumpling
changed the title
goimports with --fix don't fix missing newline at EOF
goimports with --fix doesn't fix missing newline at EOF
Mar 30, 2023
Probably worth mentioning that the same happens with gofmt:
$ golangci-lint run --no-config --disable-all -E gofmt test.go
test.go:7: File is not `gofmt`-ed with `-s` (gofmt)
}
$ golangci-lint run --fix --no-config --disable-all -E gofmt test.go
$ golangci-lint run --no-config --disable-all -E gofmt test.go
test.go:7: File is not `gofmt`-ed with `-s` (gofmt)
}
Welcome
Description of the problem
Goimports can detect the absence of a newline at EOF, but it doesn't fix the problem with
--fix
flag.Full log is in the details
Standalone tool works fine:
This bug is the same as #1373, but it was closed about a year ago with no actual fix.
Version of golangci-lint
Configuration file
Go environment
Verbose output of running
Code example or link to a public repository
The text was updated successfully, but these errors were encountered: