File tree Expand file tree Collapse file tree 5 files changed +50
-26
lines changed Expand file tree Collapse file tree 5 files changed +50
-26
lines changed Original file line number Diff line number Diff line change 2727 - uses : actions/setup-go@v5
2828 with :
2929 go-version : " ${{ env.GO_VERSION }}"
30- - uses : golangci/golangci-lint-action@v6
30+ - uses : golangci/golangci-lint-action@v7
3131 with :
32- version : v1.64
32+ version : v2.0
3333 # Extra linters, only checking new code from a pull request.
3434 - name : lint-extra
3535 if : github.event_name == 'pull_request'
Original file line number Diff line number Diff line change 22# github PRs only (see lint-extra in .github/workflows/validate.yml).
33#
44# For the default linter config, see .golangci.yml. This config should
5- # only enable additional linters not enabled in the default config.
5+ # only enable additional linters and/or linter settings not enabled
6+ # in the default config.
7+ version : " 2"
68
79linters :
8- disable-all : true
10+ default : none
911 enable :
1012 - godot
1113 - revive
12-
14+ - staticcheck
15+ settings :
16+ staticcheck :
17+ checks :
18+ - all
19+ - -QF1008 # https://staticcheck.dev/docs/checks/#QF1008 Omit embedded fields from selector expression.
20+ exclusions :
21+ generated : strict
Original file line number Diff line number Diff line change 11# For documentation, see https://golangci-lint.run/usage/configuration/
2+ version : " 2"
3+
4+ formatters :
5+ enable :
6+ - gofumpt
7+ exclusions :
8+ generated : strict
29
310linters :
411 enable :
512 - errorlint
6- - gofumpt
713 - nolintlint
814 - unconvert
915 - unparam
10-
11- linters-settings :
12- govet :
13- enable :
14- - nilness
16+ settings :
17+ govet :
18+ enable :
19+ - nilness
20+ staticcheck :
21+ checks :
22+ - all
23+ - -ST1000 # https://staticcheck.dev/docs/checks/#ST1000 Incorrect or missing package comment.
24+ - -ST1003 # https://staticcheck.dev/docs/checks/#ST1003 Poorly chosen identifier.
25+ - -ST1005 # https://staticcheck.dev/docs/checks/#ST1005 Incorrectly formatted error string.
26+ - -QF1008 # https://staticcheck.dev/docs/checks/#QF1008 Omit embedded fields from selector expression.
27+ exclusions :
28+ generated : strict
29+ presets :
30+ - comments
31+ - std-error-handling
Original file line number Diff line number Diff line change @@ -261,7 +261,7 @@ func (e *emulator) Apply(rule devices.Rule) error {
261261}
262262
263263// emulatorFromList takes a reader to a "devices.list"-like source, and returns
264- // a new Emulator that represents the state of the devices cgroup. Note that
264+ // a new emulator that represents the state of the devices cgroup. Note that
265265// black-list devices cgroups cannot be fully reconstructed, due to limitations
266266// in the devices cgroup API. Instead, such cgroups are always treated as
267267// "allow all" cgroups.
@@ -301,11 +301,12 @@ func emulatorFromList(list io.Reader) (*emulator, error) {
301301// disruptive rules (like denying all device access) will only be applied if
302302// necessary.
303303//
304- // This function is the sole reason for all of Emulator -- to allow us
304+ // This function is the sole reason for all of emulator -- to allow us
305305// to figure out how to update a containers' cgroups without causing spurious
306306// device errors (if possible).
307- func (source * emulator ) Transition (target * emulator ) ([]* devices.Rule , error ) { //nolint:revive // Ignore receiver-naming warning.
307+ func (e * emulator ) Transition (target * emulator ) ([]* devices.Rule , error ) {
308308 var transitionRules []* devices.Rule
309+ source := e
309310 oldRules := source .rules
310311
311312 // If the default policy doesn't match, we need to include a "disruptive"
Original file line number Diff line number Diff line change @@ -18,17 +18,14 @@ import (
1818// cgroupv2 files with .min, .max, .low, or .high suffix.
1919// The value of -1 is converted to "max" for cgroupv1 compatibility
2020// (which used to write -1 to remove the limit).
21- func numToStr (value int64 ) (ret string ) {
22- switch {
23- case value == 0 :
24- ret = ""
25- case value == - 1 :
26- ret = "max"
27- default :
28- ret = strconv .FormatInt (value , 10 )
29- }
30-
31- return ret
21+ func numToStr (value int64 ) string {
22+ switch value {
23+ case 0 :
24+ return ""
25+ case - 1 :
26+ return "max"
27+ }
28+ return strconv .FormatInt (value , 10 )
3229}
3330
3431func isMemorySet (r * cgroups.Resources ) bool {
@@ -57,7 +54,7 @@ func setMemory(dirPath string, r *cgroups.Resources) error {
5754 if swapStr != "" {
5855 if err := cgroups .WriteFile (dirPath , "memory.swap.max" , swapStr ); err != nil {
5956 // If swap is not enabled, silently ignore setting to max or disabling it.
60- if ! (errors .Is (err , os .ErrNotExist ) && (swapStr == "max" || swapStr == "0" )) {
57+ if ! (errors .Is (err , os .ErrNotExist ) && (swapStr == "max" || swapStr == "0" )) { //nolint:staticcheck // Ignore "QF1001: could apply De Morgan's law".
6158 return err
6259 }
6360 }
You can’t perform that action at this time.
0 commit comments