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

Avoid generated files #239

Closed
dsnet opened this issue Sep 7, 2016 · 6 comments
Closed

Avoid generated files #239

dsnet opened this issue Sep 7, 2016 · 6 comments

Comments

@dsnet
Copy link
Member

dsnet commented Sep 7, 2016

Generated source files are not generally expected to follow proper Go style. For example, running lint on a protobuf-generated Go file reports hundreds of lint issues.

With the upcoming generator disclaimer headers, we should consider having lint ignore these types of source files: golang/go#13560

@aahoughton
Copy link

Is it jumping the gun to say that the consensus is look for one of "DO NOT EDIT" or "Code generated by" in the first comment block?

@spenczar
Copy link

spenczar commented May 4, 2017

Now that the code generation header is formalized via https://golang.org/s/generatedcode, this seems tractable.

@therealplato
Copy link

I'm still experiencing linting alerts for generated files. I'm running go 1.8, my $GOPATH.../lint repo's master references c5fb716 which appears current.

I have two files generated by protoc-gen-go whose header block matches the pattern// Code generated ...\n\n... DO NOT EDIT."
I expected that when I run golint in the folder with these, that i would not receive warnings, but actually I still get the warnings.

Ditto for running golint from vim-go.

Unless I'm missing something, the isGenerated function is broken. repro'd here: https://gist.github.com/therealplato/27e1c3ea716b25674ca158c9b9496cd2

@dsnet
Copy link
Member Author

dsnet commented Jul 3, 2017

You must have an old version of protoc-gen-go. This was fixed in golang/protobuf@47eb67e

@therealplato
Copy link

Thanks @dsnet. The code was certainly generated before that commit

@youleiy
Copy link

youleiy commented Dec 1, 2017

"go.lintFlags": [
    "--exclude=\"\bexported \\w+ (\\S*['.]*)([a-zA-Z'.*]*) should have comment or be unexported\b\""
]

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

No branches or pull requests

5 participants