Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linters #1107

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ jobs:
EUREKA_ADDR: http://localhost:${{ job.services.eureka.ports[8761] }}/eureka
run: go test -v -race -coverprofile=coverage.coverprofile -covermode=atomic -tags integration ./...

- name: Run linters
run: make -k lint

- name: Upload coverage
uses: codecov/codecov-action@v1
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ Session.vim
# auto-generated tag files
tags

/bin/
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
OS = $(shell uname | tr A-Z a-z)

REVIVE_VERSION = 1.0.7
STATICCHECK_VERSION = 2021.1

bin/revive: bin/revive-${REVIVE_VERSION}
@ln -sf revive-${REVIVE_VERSION} bin/revive
bin/revive-${REVIVE_VERSION}:
@mkdir -p bin
curl -L https://github.com/mgechev/revive/releases/download/v${REVIVE_VERSION}/revive_${REVIVE_VERSION}_$(shell uname)_x86_64.tar.gz | tar -zOxf - revive > ./bin/revive-${REVIVE_VERSION} && chmod +x ./bin/revive-${REVIVE_VERSION}

bin/staticcheck: bin/staticcheck-${STATICCHECK_VERSION}
@ln -sf staticcheck-${STATICCHECK_VERSION} bin/staticcheck
bin/staticcheck-${STATICCHECK_VERSION}:
@mkdir -p bin
curl -L https://github.com/dominikh/go-tools/releases/download/${STATICCHECK_VERSION}/staticcheck_${OS}_amd64.tar.gz | tar -zOxf - staticcheck > ./bin/staticcheck-${STATICCHECK_VERSION} && chmod +x ./bin/staticcheck-${STATICCHECK_VERSION}

.PHONY: lint
lint: bin/revive bin/staticcheck
go vet ./...
bin/revive ./...
bin/staticcheck ./...
gofmt -l -s -e . | grep .go && exit 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gofmt formatting can—and has, more than oncechange between versions of Go, how will we handle that when our builds straddle the versions where a change is made?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the linters Peter listed in his last comment. I don't mind dropping gofmt.

26 changes: 0 additions & 26 deletions lint

This file was deleted.