checkspaces checks if there is a space between // and directives.
go get github.com/masibw/checkspaces/cmd/checkspaces
go install github.com/masibw/checkspaces/cmd/checkspaces@latest
go vet -vettool=`which checkspaces` ./...
var (
// go:embed testfile.txt
fileInvalid []byte
)
Output
./main.go:9:2: There is a space between slash and the directive: go:embed
You can add any directives that you want to check whether if there is a space between // and directives.
You can place config file as checkspaces.yml
.
directive:
- any
- something:else
checkspaces searches for checkspaces.yml in directories up to the root from the file directory which analyzing currently. (not the working directory(command executed))
You can use the -checkspaces.configPath flag at runtime to indicate config by an absolute path.