mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-08-07 01:14:22 +02:00
An unchecked type assertion panics on input it did not expect, as a missing `tool_cache` key did in https://gitea.com/gitea/runner/pulls/1122.
Every flagged site is now handled where it can fail, or typed so it cannot: a `lock.Keyed` replaces the two `sync.Map` mutex registries, and the reporter's outputs carry an explicit sent flag. Mocks keep their assertions, a mismatch there is a setup error the panic names.
Bugs it turned up (only the first is reachable from workflows):
1. A scalar `matrix.include` or `matrix.exclude`, e.g. `include: foo` or `include: [1, 2]`, panicked the runner with `interface conversion: interface {} is string, not map[string]interface {}`. Verified against `main`, it is now a workflow error. `OnSchedule` panicked the same way on a malformed `on.schedule` entry.
1. `ExternalURL()` panicked on the nil listener after `Close()`, the port is now resolved once at startup.
1. `errors.Is(err, git.ErrShortRef)` followed by `err.(*git.Error)` panics as soon as anything wraps that error, so it is `errors.As` now.
1. An output name the server acknowledged without ever being sent one was recorded as sent forever, which silently dropped a later value for that name.
48576ab3e5 fixes one discovered issue: a matrix key holding a nested object was logged and then run as if the job had no matrix, so it now fails like an unknown `exclude` key.
Reviewed-on: https://gitea.com/gitea/runner/pulls/1123
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
130 lines
2.7 KiB
YAML
130 lines
2.7 KiB
YAML
version: "2"
|
|
output:
|
|
sort-order:
|
|
- file
|
|
linters:
|
|
default: none
|
|
enable:
|
|
- bidichk
|
|
- bodyclose
|
|
- depguard
|
|
- dupl
|
|
- errcheck
|
|
- forbidigo
|
|
- forcetypeassert
|
|
- gocheckcompilerdirectives
|
|
- gocritic
|
|
- goheader
|
|
- govet
|
|
- ineffassign
|
|
- mirror
|
|
- modernize
|
|
- nakedret
|
|
- nilnil
|
|
- nolintlint
|
|
- perfsprint
|
|
- revive
|
|
- staticcheck
|
|
- testifylint
|
|
- unconvert
|
|
- unparam
|
|
- unused
|
|
- usestdlibvars
|
|
- usetesting
|
|
- wastedassign
|
|
settings:
|
|
depguard:
|
|
rules:
|
|
main:
|
|
deny:
|
|
- pkg: io/ioutil
|
|
desc: use os or io instead
|
|
- pkg: golang.org/x/exp
|
|
desc: it's experimental and unreliable
|
|
- pkg: github.com/pkg/errors
|
|
desc: use builtin errors package instead
|
|
nolintlint:
|
|
allow-unused: false
|
|
require-explanation: true
|
|
require-specific: true
|
|
gocritic:
|
|
enabled-checks:
|
|
- equalFold
|
|
disabled-checks:
|
|
- ifElseChain
|
|
revive:
|
|
severity: error
|
|
rules:
|
|
- name: blank-imports
|
|
- name: constant-logical-expr
|
|
- name: context-as-argument
|
|
- name: context-keys-type
|
|
- name: dot-imports
|
|
- name: empty-lines
|
|
- name: error-return
|
|
- name: error-strings
|
|
- name: exported
|
|
- name: identical-branches
|
|
- name: if-return
|
|
- name: increment-decrement
|
|
- name: modifies-value-receiver
|
|
- name: package-comments
|
|
- name: redefines-builtin-id
|
|
- name: superfluous-else
|
|
- name: time-naming
|
|
- name: unexported-return
|
|
- name: var-declaration
|
|
- name: var-naming
|
|
staticcheck:
|
|
checks:
|
|
- all
|
|
- -ST1005
|
|
usetesting:
|
|
os-temp-dir: true
|
|
perfsprint:
|
|
concat-loop: false
|
|
govet:
|
|
enable:
|
|
- nilness
|
|
- unusedwrite
|
|
goheader:
|
|
values:
|
|
regexp:
|
|
HEADER: 'Copyright \d{4} The Gitea Authors\. All rights reserved\.(\nCopyright [^\n]+)*\nSPDX-License-Identifier: MIT'
|
|
template: '{{ HEADER }}'
|
|
exclusions:
|
|
generated: lax
|
|
presets:
|
|
- comments
|
|
- common-false-positives
|
|
- legacy
|
|
- std-error-handling
|
|
rules:
|
|
- linters:
|
|
- forbidigo
|
|
path: cmd
|
|
- linters:
|
|
- forcetypeassert
|
|
path: _test\.go
|
|
issues:
|
|
max-issues-per-linter: 0
|
|
max-same-issues: 0
|
|
formatters:
|
|
enable:
|
|
- gci
|
|
- gofumpt
|
|
settings:
|
|
gci:
|
|
custom-order: true
|
|
sections:
|
|
- standard
|
|
- prefix(gitea.com/gitea/runner)
|
|
- blank
|
|
- default
|
|
gofumpt:
|
|
extra-rules: true
|
|
exclusions:
|
|
generated: lax
|
|
run:
|
|
timeout: 10m
|