Skip to content

Commit 4d3d932

Browse files
authored
Merge pull request #131 from mna/cleanup-linting
Update linting to golangci-lint
2 parents 5f0a678 + 3d41437 commit 4d3d932

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ For a new feature, it must be thoroughly tested. New code without new test(s) is
2222

2323
Respect the coding style of the repository, which means essentially to respect the [coding guidelines of the Go community][2]. Use `gofmt` to format your code, and `goimports` to add and format the list of imported packages (or do it manually, but in a `goimports`-style).
2424

25-
Once all code is done and tests pass, regenerate the whole tree with `make`, run `make lint` to make sure the code is correct, and run tests again. You are now ready to submit the pull request.
25+
Once all code is done and tests pass, regenerate the whole tree with `make`, run `make lint` (does need [`golangci-lint`](https://golangci-lint.run/))to make sure the code is correct, and run tests again. You are now ready to submit the pull request.
2626

2727
## Licensing
2828

Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,7 @@ $(TEST_DIR)/left_recursion_thrownrecover/left_recursion_thrownrecover.go: \
231231
$(BINDIR)/pigeon -nolint -support-left-recursion $< > $@
232232

233233
lint:
234-
golint ./...
235-
go vet ./...
236-
237-
gometalinter:
238-
gometalinter ./...
234+
golangci-lint run ./...
239235

240236
cmp:
241237
@boot=$$(mktemp) && $(BINDIR)/bootstrap-pigeon $(PIGEON_GRAMMAR) > $$boot && \
@@ -252,5 +248,5 @@ clean:
252248
rm -f $(BOOTSTRAPPIGEON_DIR)/bootstrap_pigeon.go $(ROOT)/pigeon.go $(TEST_GENERATED_SRC) $(EXAMPLES_DIR)/json/optimized/json.go $(EXAMPLES_DIR)/json/optimized-grammar/json.go $(TEST_DIR)/staterestore/optimized/staterestore.go $(TEST_DIR)/staterestore/standard/staterestore.go $(TEST_DIR)/issue_65/optimized/issue_65.go $(TEST_DIR)/issue_65/optimized-grammar/issue_65.go
253249
rm -rf $(BINDIR)
254250

255-
.PHONY: all clean lint gometalinter cmp test
251+
.PHONY: all clean lint cmp test
256252

builder/builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func SupportLeftRecursion(support bool) Option {
8989

9090
// Nolint returns an option that specifies the nolint option
9191
// If nolint is true, special '// nolint: ...' comments are added
92-
// to the generated parser to suppress warnings by gometalinter.
92+
// to the generated parser to suppress warnings by gometalinter or golangci-lint.
9393
func Nolint(nolint bool) Option {
9494
return func(b *builder) Option {
9595
prev := b.nolint

doc.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ The following options can be specified:
3636
-debug : boolean, print debugging info to stdout (default: false).
3737
3838
-nolint: add '// nolint: ...' comments for generated parser to suppress
39-
warnings by gometalinter (https://github.com/alecthomas/gometalinter).
39+
warnings by gometalinter (https://github.com/alecthomas/gometalinter) or
40+
golangci-lint (https://golangci-lint.run/).
4041
4142
-no-recover : boolean, if set, do not recover from a panic. Useful
4243
to access the panic stack when debugging, otherwise the panic

main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func main() {
4343
dbgFlag = fs.Bool("debug", false, "set debug mode")
4444
shortHelpFlag = fs.Bool("h", false, "show help page")
4545
longHelpFlag = fs.Bool("help", false, "show help page")
46-
nolint = fs.Bool("nolint", false, "add '// nolint: ...' comments to suppress warnings by gometalinter")
46+
nolint = fs.Bool("nolint", false, "add '// nolint: ...' comments to suppress warnings by gometalinter or golangci-lint")
4747
noRecoverFlag = fs.Bool("no-recover", false, "do not recover from panic")
4848
outputFlag = fs.String("o", "", "output file, defaults to stdout")
4949
optimizeBasicLatinFlag = fs.Bool("optimize-basic-latin", false, "generate optimized parser for Unicode Basic Latin character sets")
@@ -189,7 +189,8 @@ the generated code is written to this file instead.
189189
display this help message.
190190
-nolint
191191
add '// nolint: ...' comments for generated parser to suppress
192-
warnings by gometalinter (https://github.com/alecthomas/gometalinter).
192+
warnings by gometalinter (https://github.com/alecthomas/gometalinter) or
193+
golangci-lint (https://golangci-lint.run/).
193194
-no-recover
194195
do not recover from a panic. Useful to access the panic stack
195196
when debugging, otherwise the panic is converted to an error.

0 commit comments

Comments
 (0)