This repository holds the GitHub Action for deadcode.
The deadcode command reports unreachable functions in Go programs. See details on Go's support for finding unreachable functions.
The deadcode GitHub Action is currently experimental and is under active development.
To use the deadcode GitHub Action add the following step to your workflow:
- id: deadcode
uses: lost-coders/deadcode-action@v0.1.0
By default, the deadcode Github Action will run with the latest version of Go and analyze all packages in the provided Go module. Assuming you have the latest Go version installed locally, this is equivalent to running the following on your command line:
deadcode ./...
To specify a specific Go version, directory in which to run deadcode, or package pattern, use the following syntax:
- id: deadcode
uses: lost-coders/deadcode-action@v0.1.0
with:
go-version: <your-Go-version>
go-package: <your-package-pattern>
For example, the code snippet below runs deadcode against a repository on every push:
on: [push]
jobs:
deadcode_job:
runs-on: ubuntu-latest
name: Run deadcode
steps:
- id: deadcode
uses: lost-coders/deadcode-action@v0.1.0
with:
go-version: "1.21"
go-package: "./..."
deadcode Github Action accepts several other optional inputs:
repo-checkout: checkout the repository, default true
check-latest: check for the latest Go version, default false
go-version-file: go.mod or go.work file specifying Go version, default ""
cache: cache the Go version, default true
flags: flags to run with deadcode, default ""
The precedence for inputs go-version
, go-version-file
, and check-latest
specifying the Go version inherits from
actions/setup-go.
When a dead function is detected, an error will display for that GitHub job regarding the identified function.
Unless otherwise noted, the source files fall under the BSD-style license found in the LICENSE file.