Skip to content

Commit

Permalink
GHA: Add staticchck workflow
Browse files Browse the repository at this point in the history
Ref:
  * containers#4880
  * containers#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 <cevich@redhat.com>
  • Loading branch information
cevich committed Jun 28, 2023
1 parent 33b7088 commit f9dbe0c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/staticcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---

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
# Ref: https://github.com/WillAbides/setup-go-faster
- uses: WillAbides/setup-go-faster@v1.7.0
with:
go-version: "*"
# 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 }}"

0 comments on commit f9dbe0c

Please sign in to comment.