From c65ae974dd92959b9a26e8e5dafc2ac4fc888dac Mon Sep 17 00:00:00 2001 From: decentral1se Date: Thu, 15 Jul 2021 23:49:58 +0200 Subject: [PATCH] Add experimental staticcheck into linting CI See https://staticcheck.io for more. This is set to be ignored on failure so that it doesn't disrupt current work flows but maybe it is nice to add. Just drop the `ignore: ...` line and it will fail builds. --- .drone.yml | 10 ++++++++++ Makefile | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 6a1229f..23159bc 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,6 +7,16 @@ steps: commands: - make check + - name: make static + image: golang:1.16 + ignore: true # until we decide we all want this check + environment: + STATIC_CHECK_URL: honnef.co/go/tools/cmd/staticcheck + STATIC_CHECK_VERSION: v0.2.0 + commands: + - go install $STATIC_CHECK_URL@$STATIC_CHECK_VERSION + - make static + - name: make build image: golang:1.16 commands: diff --git a/Makefile b/Makefile index f11f6bc..0f85de6 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ GOPATH := $(shell go env GOPATH) VERSION := $(shell cat ./version) LDFLAGS := "-X 'main.Commit=$(COMMIT)' -X 'main.Version=$(VERSION)'" -all: run install build clean format check +all: run install build clean format check static run: @go run -ldflags=$(LDFLAGS) $(ABRA) @@ -23,3 +23,6 @@ format: check: @test -z $$(gofmt -l .) || (echo "gofmt: formatting issue - run 'make format' to resolve" && exit 1) + +static: + @staticcheck $(ABRA)