Skip to content
This repository was archived by the owner on May 9, 2021. It is now read-only.

Conversation

calebdoxsey
Copy link

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:

//go:generate something

Not Valid:

// go:generate something

Seemed like a reasonable thing to lint.

golint/golint.go Outdated
@@ -16,7 +16,7 @@ import (
"path/filepath"
"strings"

"github.com/golang/lint"
"github.com/calebdoxsey/lint"

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

Copy link
Author

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") &&

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:.

Copy link
Author

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:")
Copy link
Member

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.

@gopherbot
Copy link

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 comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link

Message from Gobot Gobot:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
Within the next week or so, a maintainer will review your change and provide
feedback. See https://golang.org/doc/contribute.html#review for more info and
tips to get your patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11, it means that this CL will be reviewed as part of the next development
cycle. See https://golang.org/s/release for more details.


Please don’t reply on this GitHub thread. Visit golang.org/cl/96081.
After addressing review feedback, remember to publish your drafts!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants