-
Notifications
You must be signed in to change notification settings - Fork 482
lint spaces between commend and go:generate directive #291
Conversation
golint/golint.go
Outdated
@@ -16,7 +16,7 @@ import ( | |||
"path/filepath" | |||
"strings" | |||
|
|||
"github.com/golang/lint" | |||
"github.com/calebdoxsey/lint" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"github.com/golang/lint" - this shouldn't change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops. will change it back
lint.go
Outdated
} | ||
txt = txt[2:] | ||
// if there's space before go:generate, this was probably a mistake | ||
if !strings.HasPrefix(txt, "go:generate") && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are more pragmas, not just go:generate
. You may want to check for // go:
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea
// if there's space before go:, this was probably a mistake | ||
if !strings.HasPrefix(txt, "go:") && | ||
strings.HasPrefix(strings.TrimSpace(txt), "go:") { | ||
f.errorf(cg, 0.9, category("comments"), "go: pragmas should have no spaces between // and go:") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"should" is a misnomer here. it implies that you should but it's not required. I would make this more explicit.
This PR (HEAD: fa0f6d6) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/#/c/lint/+/96081 to see it. Tip: You can toggle comments from me using the |
Message from Gobot Gobot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/96081. |
From: https://groups.google.com/forum/#!topic/golang-nuts/ipxQhlHKQWs
Looks like sometimes people forget that there can be no spaces before
go:generate
.Valid:
Not Valid:
Seemed like a reasonable thing to lint.