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
{{ message }}
This repository has been archived by the owner on May 9, 2021. It is now read-only.
I've hit an edge case for the implementation in a5f4a24 which should fix #239
If the comment appears after very long lines (local reproduced with round about 65535 characters) it's not detected.
The following
a_b := `...`
// Code generated by some tool. DO NOT EDIT.
leads to an error. ... represents 65527 null bytes. This also appears with more complete go files and real world content (e.g. static assets like minified JS).
Short program to generate test files
package main
import (
"flag"
"os"
)
var count = flag.Int("count", 0, "Length of variable content")
func check(e error) {
if e != nil {
panic(e)
}
}
func main() {
flag.Parse()
head := []byte("a_b := `")
bottom := []byte("`\n// Code generated by some tool. DO NOT EDIT.")
f, err := os.Create("test.go")
check(err)
defer f.Close()
content := make([]byte, *count, *count)
_, err = f.Write(head)
check(err)
_, err = f.Write(content)
check(err)
_, err = f.Write(bottom)
check(err)
f.Sync()
}
Used like
$ for i in 65526 65527; do echo ${i}; ./writer -count ${i}; golint -set_exit_status test.go || abort; done
65526
65527
test.go:1:1: expected 'package', found a_b (and 65527 more errors)
What did you expect to see?
No error
What did you see instead?
test.go:1:1: expected 'package', found a_b (and 65527 more errors)
The text was updated successfully, but these errors were encountered:
Thank you for submitting this issue! As per golang/go#38968, we are freezing and deprecating golint. There's no drop-in replacement to golint per se, but you should find that Staticcheck works well in encouraging good Go code, much like golint did in the past, since it also includes style checks. There's always gofmt and go vet too, of course.
If you would like to contribute further, I'd encourage you to engage Staticcheck's issue tracker or look at vet's open issues, as they are both actively maintained. If you have an idea that doesn't fit into either of those tools, you could look at other Go linters, or write your own - these days it's fairly straightforward with go/analysis.
To help avoid confusion, I'm closing all issues before we freeze the repository. If you have any feedback, you can leave a comment on the proposal thread where it was decided to deprecate golint - though note that the proposal has been accepted for nearly a year. Thanks!
What version of Go are you using (
go version
)?go version go1.11 darwin/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
I've hit an edge case for the implementation in a5f4a24 which should fix #239
If the comment appears after very long lines (local reproduced with round about 65535 characters) it's not detected.
The following
leads to an error.
...
represents 65527 null bytes. This also appears with more complete go files and real world content (e.g. static assets like minified JS).Short program to generate test files
Used like
What did you expect to see?
No error
What did you see instead?
test.go:1:1: expected 'package', found a_b (and 65527 more errors)
The text was updated successfully, but these errors were encountered: