From 9d17eeafe2ab4bb299b336f1b8a99c9feb1c98ea Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Wed, 28 Jun 2023 11:50:15 -0400 Subject: [PATCH] GHA: Add staticchck workflow Ref: * #4880 * #4884 This is ***NOT*** the same thing as the golangci-lint staticcheck. It checks other items not covered by golangci-lint, such as multiple (redundant) package imports). Signed-off-by: Chris Evich --- .github/workflows/staticcheck.yml | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/staticcheck.yml diff --git a/.github/workflows/staticcheck.yml b/.github/workflows/staticcheck.yml new file mode 100644 index 00000000000..7df3ae989e3 --- /dev/null +++ b/.github/workflows/staticcheck.yml @@ -0,0 +1,33 @@ +--- + +name: "Golang Static Check" + +on: ["push", "pull_request"] + +permissions: "read-all" + +jobs: + static_check: + name: "Golang Static Check" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + - uses: WillAbides/setup-go-faster@v1.7.0 + with: + go-version: "tip" + # Ignore whatever was already installed on the system + ignore-local: "true" + # Lookup minimum version, don't make suggestions for go versions older than it. + - id: gomod + run: | + printf "version=%s" $(grep -E -m 1 '^go' go.mod | awk '{print $2}') >> $GITHUB_OUTPUT + tail -1 $GITHUB_OUTPUT + # Ref: https://staticcheck.dev/docs/running-staticcheck/ci/github-actions/ + # N/B: The staticcheck tool requires golang 1.19+ + - uses: dominikh/staticcheck-action@v1.2.0 + with: + # Renovate manages this value, manual changes are permitted if required. + version: "2023.1.3" + min-go-version: "${{ steps.gomod.outputs.version }}"