From 220143487960d26aeab019032da1c078d518ab63 Mon Sep 17 00:00:00 2001 From: max furman Date: Mon, 23 Oct 2023 23:19:47 -0700 Subject: [PATCH 1/2] Fix actionlint warning | add common targets to Makefile --- .github/workflows/release.yml | 2 +- Makefile | 43 +++++++++++++++++++++++++++++++++++ go.mod | 9 +++++--- go.sum | 4 ++-- 4 files changed, 52 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d4cc344..0c4d2f7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: echo ${{ github.ref }} | grep "\-rc.*" OUT=$? if [ $OUT -eq 0 ]; then IS_PRERELEASE=true; else IS_PRERELEASE=false; fi - echo "IS_PRERELEASE=${IS_PRERELEASE}" >> ${GITHUB_OUTPUT} + echo "IS_PRERELEASE=${IS_PRERELEASE}" >> "${GITHUB_OUTPUT}" - name: Create Release id: create_release uses: actions/create-release@v1 diff --git a/Makefile b/Makefile index bb5e266..4d3e5ee 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,28 @@ +# Set V to 1 for verbose output from the Makefile +Q=$(if $V,,@) +SRC=$(shell find . -type f -name '*.go') + +all: lint test + +ci: test + +.PHONY: all ci + +######################################### +# Bootstrapping +######################################### + +bootstra%: + $Q curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin latest + $Q go install golang.org/x/vuln/cmd/govulncheck@latest + $Q go install gotest.tools/gotestsum@latest + +.PHONY: bootstrap + +######################################### +# Test +######################################### + test: go test -cover ./... @@ -6,3 +31,21 @@ test-race: go test -cover -race ./... .PHONY: test test-race + +######################################### +# Linting +######################################### + +fmt: + $Q goimports -l -w $(SRC) + +lint: golint govulncheck + +golint: SHELL:=/bin/bash +golint: + $Q LOG_LEVEL=error golangci-lint run --config <(curl -s https://raw.githubusercontent.com/smallstep/workflows/master/.golangci.yml) --timeout=30m + +govulncheck: + $Q govulncheck ./... + +.PHONY: fmt lint golint govulncheck diff --git a/go.mod b/go.mod index ae5d638..7f3d808 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,16 @@ module github.com/smallstep/scep -go 1.16 +go 1.20 require ( github.com/go-kit/kit v0.4.0 + go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 +) + +require ( github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-stack/stack v1.6.0 // indirect - go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 ) // use github.com/smallstep/pkcs7 fork with patches applied -replace go.mozilla.org/pkcs7 => github.com/smallstep/pkcs7 v0.0.0-20230302202335-4c094085c948 +replace go.mozilla.org/pkcs7 => github.com/smallstep/pkcs7 v0.0.0-20230615175518-7ce6486b74eb diff --git a/go.sum b/go.sum index b486dfb..e3f72df 100644 --- a/go.sum +++ b/go.sum @@ -4,5 +4,5 @@ github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNV github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-stack/stack v1.6.0 h1:MmJCxYVKTJ0SplGKqFVX3SBnmaUhODHZrrFF6jMbpZk= github.com/go-stack/stack v1.6.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/smallstep/pkcs7 v0.0.0-20230302202335-4c094085c948 h1:/80FqDt6pzL9clNW8G2IsRAzKGNAuzsEs7g1Y5oaM/Y= -github.com/smallstep/pkcs7 v0.0.0-20230302202335-4c094085c948/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= +github.com/smallstep/pkcs7 v0.0.0-20230615175518-7ce6486b74eb h1:wWc8z37baPz2oyusY9BVuM+uPtq6XAOb7qSegevnRs0= +github.com/smallstep/pkcs7 v0.0.0-20230615175518-7ce6486b74eb/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= From 8b66255273d87bb8ba0e9f91262b67bce62ca4a0 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 24 Oct 2023 08:27:20 -0700 Subject: [PATCH 2/2] revert go.mod golang back to 1.16 Co-authored-by: Herman Slatman --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 7f3d808..c40d3b3 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/smallstep/scep -go 1.20 +go 1.16 require ( github.com/go-kit/kit v0.4.0