Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Run golangci-lint with reviewdog

License

NotificationsYou must be signed in to change notification settings

reviewdog/action-golangci-lint

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

releaseGitHub release (latest SemVer)action-bumpr supportedUsed-by counter

This action runsgolangci-lint withreviewdog on pull requests to improvecode review experience.

annotation on diff tab examplecheck tab examplestatus check example

Migrating from v1 to v2

In many cases, you need to do nothing. Just usereviewdog/action-golangci-lint@v2 instead ofreviewdog/action-golangci-lint@v1.

If your workflow have steps for setting up Go and caching go modules, they are no longer needed.reviewdog/action-golangci-lint@v2 now set up Go and cache modules automatically, so remove these steps.

on:[pull_request]jobs:golangci-lint:runs-on:ubuntu-lateststeps:      -name:Check out code into the Go module directoryuses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2with:fetch-depth:0# no need with v2# - name: Set up Go#   uses: actions/setup-go@v2#   with:#     go-version: '1.17'# no need with v2# - uses: actions/cache@v2#   with:#     path: |#         ~/.cache/golangci-lint#         ~/.cache/go-build#         ~/go/pkg/mod#     key: ${{ runner.os }}-golangcilint-${{ hashFiles('**/go.sum') }}#     restore-keys: |#       ${{ runner.os }}-golangcilint-      -name:golangci-lintuses:reviewdog/action-golangci-lint@3dfdce20f5ca12d264c214abb993dbb40834da90# v2.7.2

Inputs

github_token

Required. Default is${{ github.token }}.

golangci_lint_flags

Optional. golangci-lint flags. (golangci-lint run --out-format=line-number<golangci_lint_flags>)

Note that you can change golangci-lint behavior byconfigurationfile too.

tool_name

Optional. Tool name to use for reviewdog reporter. Useful when running multipleactions with different config.

level

Optional. Report level for reviewdog [info,warning,error].It's same as-level flag of reviewdog.

workdir

Optional. Working directory relative to the root directory.

reporter

Optional. Reporter of reviewdog command [github-pr-check,github-pr-review].It's same as-reporter flag of reviewdog.

filter_mode

Optional. Filtering mode for the reviewdog command [added,diff_context,file,nofilter].Default is added.

fail_level

Optional. If set tonone, always use exit code 0 for reviewdog.Otherwise, exit code 1 for reviewdog if it finds at least 1 issue with severity greater than or equal to the given level.Possible values: [none,any,info,warning,error]Default isnone.

fail_on_error

Deprecated, usefail_level instead.Optional. Exit code for reviewdog when errors are found [true,false]Default isfalse.

reviewdog_flags

Optional. Additional reviewdog flags

go_version

Optional. Install a specific version of Go.By default, the latest version of Go 1.x is installed.

go_version_file

Optional. Install a specific version of Go from a file. It accepts a path to ago.mod file or a file containing only Go version.If both thego_version and thego_version_file inputs are provided then thego_version input is used.

cache

Optional. [true,false]It enables cache. The action caches~/.cache/golangci-lint,~/.cache/go-build,~/go/pkg/mod.Default istrue.

reviewdog_version

Optional. Install a specific version of reviewdog.By default, the latest version of reviewdog is installed.

golangci_lint_version

Optional. Install a specific version of golangci-lint.By default, the latest version of golangci-lint is installed.

Example usage

Minimum Usage Example

name:reviewdogon:[pull_request]jobs:golangci-lint:name:runner / golangci-lintruns-on:ubuntu-lateststeps:      -name:Check out code into the Go module directoryuses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2with:fetch-depth:0      -name:golangci-lintuses:reviewdog/action-golangci-lint@3dfdce20f5ca12d264c214abb993dbb40834da90# v2.7.2

Advanced Usage Example

name:reviewdogon:[pull_request]jobs:# NOTE: golangci-lint doesn't report multiple errors on the same line from# different linters and just report one of the errors?golangci-lint:name:runner / golangci-lintruns-on:ubuntu-lateststeps:      -name:Check out code into the Go module directoryuses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2with:fetch-depth:0      -name:golangci-lintuses:reviewdog/action-golangci-lint@3dfdce20f5ca12d264c214abb993dbb40834da90# v2.7.2with:# optionally use a specific version of Go rather than the latest onego_version:"1.17"# Can pass --config flag to change golangci-lint behavior and target# directory.golangci_lint_flags:"--config=.github/.golangci.yml ./testdata"workdir:subdirectory/# Use golint via golangci-lint binary with "warning" level.golint:name:runner / golintruns-on:ubuntu-lateststeps:      -name:Check out code into the Go module directoryuses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2with:fetch-depth:0      -name:golintuses:reviewdog/action-golangci-lint@3dfdce20f5ca12d264c214abb993dbb40834da90# v2.7.2with:golangci_lint_flags:"--disable-all -E golint"tool_name:golint# Change reporter name.level:warning# GitHub Status Check won't become failure with this level.# You can add more and more supported linters with different config.errcheck:name:runner / errcheckruns-on:ubuntu-lateststeps:      -name:Check out code into the Go module directoryuses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2with:fetch-depth:0      -name:errcheckuses:reviewdog/action-golangci-lint@3dfdce20f5ca12d264c214abb993dbb40834da90# v2.7.2with:golangci_lint_flags:"--disable-all -E errcheck"tool_name:errchecklevel:info# Disable cache of golangci-lint result, go build and go dependencieswith_cache:name:runner / errcheckruns-on:ubuntu-lateststeps:      -name:Check out code into the Go module directoryuses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2with:fetch-depth:0      -name:golangci-lintuses:reviewdog/action-golangci-lint@3dfdce20f5ca12d264c214abb993dbb40834da90# v2.7.2with:cache:false

All-in-one golangci-lint configuration without config file

name:reviewdogon:[pull_request]jobs:golangci-lint:name:runner / golangci-lintruns-on:ubuntu-lateststeps:      -name:Check out code into the Go module directoryuses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2with:fetch-depth:0      -name:golangci-lintuses:reviewdog/action-golangci-lint@3dfdce20f5ca12d264c214abb993dbb40834da90# v2.7.2with:golangci_lint_flags:"--enable-all --exclude-use-default=false"

[8]ページ先頭

©2009-2025 Movatter.jp