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

sso: enable golangci-lint #199

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
4 changes: 0 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ jobs:
- run:
name: get tools
command: make tools
- run:
name: copy source
command: |
mkdir bin
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't make much sense in context (it doesn't copy source!)

- run:
name: run lint and tests for both services
command: |
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version := "v1.2.0"

commit := $(shell git rev-parse --short HEAD)
gopath := $(shell go env GOPATH)


build: dist/sso-auth dist/sso-proxy
Expand All @@ -16,7 +17,7 @@ dist/sso-proxy:
go build -o dist/sso-proxy ./cmd/sso-proxy

tools:
go get golang.org/x/lint/golint
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(gopath)/bin v1.16.0
go get github.com/rakyll/statik

test:
Expand Down
15 changes: 2 additions & 13 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@ set -e

cd $(dirname "$BASH_SOURCE[0]")/..

echo "running go fmt ..."
res=$(go fmt ./...)
if [ -n "$res" ]; then
echo "$res"
echo "gofmt failed..."
exit 1
fi
echo "running golangci-lint ..."
golangci-lint run -E gofmt -E golint -E gocritic -E gosec -E misspell
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should move into a config file so running golangci-lint locally is consistent with what is run in CI


# where necessary attempts to add/remove modules from go.mod and go.sum.
echo "running go mod tidy ..."
Expand All @@ -24,12 +19,6 @@ fi
echo "running go mod verify ..."
go mod verify

echo "running golint ..."
golint -set_exit_status cmd internal

echo "running go vet ..."
go vet ./...

echo "running tests ..."
cd internal
go test -cover -race ./... $@