# staticcheck-action **Repository Path**: mirrors_dominikh/staticcheck-action ## Basic Information - **Project Name**: staticcheck-action - **Description**: Staticcheck's official GitHub Action - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-11-08 - **Last Updated**: 2026-03-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # staticcheck-action This action runs [Staticcheck](https://staticcheck.io) to find bugs and other problems in your Go code. ## Usage At its simplest, just add `dominikh/staticcheck-action` as a step in your existing workflow. A minimal workflow might look like this: ```yaml name: "CI" on: ["push", "pull_request"] jobs: ci: name: "Run CI" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: fetch-depth: 1 - uses: dominikh/staticcheck-action@v1 with: version: "latest" ``` A more advanced example that runs tests, go vet and Staticcheck on multiple OSs and Go versions looks like this: ```yaml name: "CI" on: ["push", "pull_request"] jobs: ci: name: "Run CI" strategy: fail-fast: false matrix: os: ["windows-latest", "ubuntu-latest", "macOS-latest"] go: ["1.18.x", "1.19.x"] dir: ["server", "client"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 with: fetch-depth: 1 - uses: actions/setup-go@v6 with: go-version: ${{ matrix.go }} - run: "go test ./..." - run: "go vet ./..." - uses: dominikh/staticcheck-action@v1 with: version: "latest" install-go: false cache-key: ${{ matrix.go }} working-directory: ${{ matrix.dir }} ``` Please see [GitHub's documentation on Actions](https://docs.github.com/en/actions) for extensive documentation on how to write and tweak workflows. ## Options ### `version` Which version of Staticcheck to use. Because new versions of Staticcheck introduce new checks that may break your build, it is recommended to pin to a specific version and to update Staticheck consciously. It defaults to `latest`, which installs the latest released version of Staticcheck. ### `min-go-version` Minimum version of Go that Staticcheck will report diagnostics for. That is, some diagnostics don't apply to older versions of Go. If unset, this will default to the Go version specified in your go.mod. The default is usually what you want. See https://staticcheck.io/docs/running-staticcheck/cli/#go for more information. ### `build-tags` Go build tags that get passed to Staticcheck via the `-tags` flag. ### `checks` Value to pass to Staticcheck in the `-checks` flag. This doesn't normally need to be set and defaults to `"inherit"`. ### `install-go` Whether the action should install the latest version of Go to install and run Staticcheck. If Staticcheck is the only action in your job, this option can usually be left on its default value of `true`. If your job already installs Go prior to running Staticcheck, for example to run unit tests, it is best to set this option to `false`. The latest release of Staticcheck works with the last minor release of Go at the time. ### `use-cache` If set to true (the default), this action will automatically save and restore Staticcheck's cache using the actions/cache action. ### `cache-key` String to include in the cache key, in addition to the default, which is `runner.os`. This is useful when using multiple Go versions. ### `working-directory` Relative path to the working directory Staticcheck should be executed in. This is useful when dealing with multiple projects within one repository. Can be easily combined with a directory [`matrix`](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix), see the advanced example above. ### `output-format` Output format to use. This corresponds to Staticcheck's `-f` flag. Usually you will want to use the default (`"text"`), as this format creates annotations on pull requests. When combining multiple runs with `merge-files`, you want to use the `"binary"` format on the individual runs to create the inputs to the merge run. ### `output-file` File to write Staticcheck's output to. Defaults to stdout. ### `merge-files` A newline-separated list of files to pass to `staticcheck -merge`.