From 98b820e60ee1138e558a20495d99dbc47067445a Mon Sep 17 00:00:00 2001 From: Sam Herrmann Date: Tue, 16 Jan 2024 12:44:28 -0500 Subject: [PATCH] Add lint job --- .github/workflows/go.yml | 9 +++++++-- Makefile | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c30d6b0..1158f85 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,4 +1,4 @@ - + name: Go on: @@ -8,7 +8,7 @@ on: tags: - 'v*.*.*' pull_request: - branches: + branches: - main jobs: @@ -29,6 +29,11 @@ jobs: - name: Get dependencies run: go get -v -t -d ./... + - name: Lint + uses: dominikh/staticcheck-action@v1.2.0 + with: + version: 2023.1.6 + - name: Test run: make test diff --git a/Makefile b/Makefile index 483af08..12c716a 100644 --- a/Makefile +++ b/Makefile @@ -8,12 +8,15 @@ zip = (cd dist && zip -r $$GOOS-$$GOARCH.zip $$GOOS-$$GOARCH/*) build: mkdir -p dist && go build -o dist ./serveit -build.all: +build.all: export GOOS=linux; export GOARCH=386; $(gobuild) && $(tar) export GOOS=linux; export GOARCH=amd64; $(gobuild) && $(tar) export GOOS=windows; export GOARCH=amd64; $(gobuild) && $(zip) export GOOS=windows; export GOARCH=386; $(gobuild) && $(zip) +lint: + staticcheck -checks=all ./... + test: CGO_ENABLED=1 go test ./... -race -cover @@ -21,5 +24,5 @@ clean: rm -rf dist # Resources: -# List of available target OSs and architectures: +# List of available target OSs and architectures: # https://golang.org/doc/install/source#environment \ No newline at end of file