Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Go Lint

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Download dependencies
run: go mod download

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout=5m
115 changes: 115 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
run:
timeout: 5m
go: '1.21'

linters-settings:
govet:
enable:
- shadow
revive:
min-confidence: 0.8
gocyclo:
min-complexity: 15
dupl:
threshold: 100
goconst:
min-len: 2
min-occurrences: 2
misspell:
locale: US
lll:
line-length: 140
goimports:
local-prefixes: github.com/ChristopherHX/github-act-runner
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc

linters:
enable:
- bodyclose
# - depguard # Disabled for now as it's too restrictive
- dogsled
- dupl
- errcheck
- copyloopvar # replaces exportloopref for Go 1.22+
- exhaustive
- goconst
- gocritic
- gofmt
- goimports
- revive # replaces golint
- mnd # replaces gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- noctx
- nolintlint
- rowserrcheck
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- whitespace

issues:
exclude-rules:
- path: _test\.go
linters:
- mnd
- gocritic
- gosec
- path: main\.go
linters:
- mnd
- path: protocol/
linters:
- revive # Protocol has many generated-like structs
- text: "weak cryptographic primitive"
linters:
- gosec
- text: "Use of weak random number generator"
linters:
- gosec
- text: "at least one file in a package should have a package comment"
linters:
- stylecheck
- text: "should have a package comment"
linters:
- stylecheck
- text: "package-comments: should have a package comment"
linters:
- revive
- text: "exported function .* should have comment or be unexported"
linters:
- revive
- text: "exported method .* should have comment or be unexported"
linters:
- revive
- text: "exported type .* should have comment or be unexported"
linters:
- revive
- text: "exported var .* should have comment or be unexported"
linters:
- revive

exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
5 changes: 3 additions & 2 deletions actionsdotnetactcompat/act_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ type ActRunner struct {
actionsrunner.WorkerRunnerEnvironment
}

func (arunner *ActRunner) ExecWorker(run *actionsrunner.RunRunner, wc actionsrunner.WorkerContext, jobreq *protocol.AgentJobRequestMessage, src []byte) error {
if len(arunner.WorkerArgs) <= 0 {
func (arunner *ActRunner) ExecWorker(run *actionsrunner.RunRunner, wc actionsrunner.WorkerContext,
jobreq *protocol.AgentJobRequestMessage, src []byte) error {
if len(arunner.WorkerArgs) == 0 {
ExecWorker(jobreq, wc)
return nil
}
Expand Down
Loading
Loading