thealetheia / broccoli

Using brotli compression to embed static files in Go.
MIT License
530 stars 18 forks source link

Consider moving generated file comment to satisfy golint #7

Open montanaflynn opened 4 years ago

montanaflynn commented 4 years ago

Because the current comment is put at the top it causes golint to complain:

domains.gen.go:1:1: package comment should be of the form "Package swot ..."
// Code generated by broccoli at 2020-04-20T23:26:30+07:00.
package swot

import "aletheia.icu/broccoli/fs"

var br = fs.New("...")
Screen Shot 2020-04-20 at 22 57 35

I suggest moving it to above the variable:

package swot

import "aletheia.icu/broccoli/fs"

// Code generated by broccoli at 2020-04-20T23:26:30+07:00.
var br = fs.New("...")
jonlundy commented 4 years ago

The comment should have DO NOT EDIT. and an extra blank line following. That will indicate to linters that the file is auto generated and will exclude it from linting.

See https://golang.org/s/generatedcode

EXAMPLE

// Code generated by broccoli at 2020-04-20T23:26:30+07:00. DO NOT EDIT.

package swot

import "aletheia.icu/broccoli/fs"

var br = fs.New("...")
montanaflynn commented 4 years ago

Ahh TIL, that sounds good!

montanaflynn commented 4 years ago

Changing the comment to:

// Code generated by broccoli at 2020-04-20T23:26:30+07:00. DO NOT EDIT.

Even without an extra blank line removed the warning and signaled it was a generated file.