Skip to content

Commit 0322d14

Browse files
committed
makefile: add format and golangci-lint targets
This makes easier to run locally a linter and a formatter. Also it updates instructions in CONTRIBUTING.md how to run the linter and the code formatter locally.
1 parent e0d9c21 commit 0322d14

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

CONTRIBUTING.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,16 @@ make test-multi test-uuid test-main
3939
```
4040

4141
To check if the current changes will pass the linter in CI, install
42-
golnagci-lint from [sources](https://golangci-lint.run/usage/install/)
43-
and run it with next flags:
42+
golangci-lint from [sources](https://golangci-lint.run/usage/install/)
43+
and run it with next command:
4444
```bash
45-
golangci-lint run -E goimports -D errcheck
45+
make golangci-lint
46+
```
47+
48+
To format the code install [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports)
49+
and run it with next command:
50+
```bash
51+
make format
4652
```
4753

4854
## Benchmarking

Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ clean:
2323
deps: clean
2424
( cd ./queue; tarantoolctl rocks install queue 1.1.0 )
2525

26+
.PHONY: format
27+
format:
28+
goimports -l -w .
29+
30+
.PHONY: golangci-lint
31+
golangci-lint:
32+
golangci-lint run -E goimports -D errcheck
33+
2634
.PHONY: test
2735
test:
2836
go test ./... -v -p 1

0 commit comments

Comments
 (0)