diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 01b8f7c14..0385ebc99 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,47 +11,47 @@ on: jobs: lint: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/setup-go@v5 + - uses: actions/setup-go@v6 with: - go-version: 1.x # latest - - uses: actions/checkout@v4 - - uses: golangci/golangci-lint-action@v6 + go-version: stable + - uses: actions/checkout@v5 + - uses: golangci/golangci-lint-action@v8 with: - version: v1.61 + version: v2.6 commit: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 # Only check commits on pull requests. if: github.event_name == 'pull_request' steps: - name: get pr commits id: 'get-pr-commits' - uses: tim-actions/get-pr-commits@v1.1.0 + uses: tim-actions/get-pr-commits@v1.3.1 with: token: ${{ secrets.GITHUB_TOKEN }} - name: check subject line length - uses: tim-actions/commit-message-checker-with-regex@v0.3.1 + uses: tim-actions/commit-message-checker-with-regex@v0.3.2 with: commits: ${{ steps.get-pr-commits.outputs.commits }} pattern: '^.{0,72}(\n.*)*$' error: 'Subject too long (max 72)' test: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: - go-version: [1.21.x, 1.22.x, 1.23.x] + go-version: [1.21.x, oldstable, stable] race: ["-race", ""] steps: - name: checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: install go ${{ matrix.go-version }} - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} - name: build diff --git a/.golangci.yml b/.golangci.yml index 3ee5b4bc3..aa8bba113 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,15 @@ -# For documentation, see https://golangci-lint.run/usage/configuration/ +version: "2" + +formatters: + enable: + - gofmt linters: disable: - errcheck + settings: + staticcheck: + checks: + - all # Enable all checks, except... + - -ST1005 # https://staticcheck.dev/docs/checks/#ST1005 Incorrectly formatted error string. + - -ST1000 # https://staticcheck.dev/docs/checks/#ST1000 Incorrect or missing package comment. diff --git a/cgroups/cgroups.go b/cgroups/cgroups.go index 2e03ddf6e..48beba06a 100644 --- a/cgroups/cgroups.go +++ b/cgroups/cgroups.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "slices" "strings" rspec "github.com/opencontainers/runtime-spec/specs-go" @@ -89,10 +90,8 @@ func GetSubsystemPath(pid int, subsystem string) (string, error) { continue } subelems := strings.Split(elem[1], ",") - for _, subelem := range subelems { - if subelem == subsystem { - return elem[2], nil - } + if slices.Contains(subelems, subsystem) { + return elem[2], nil } } diff --git a/cmd/runtimetest/main.go b/cmd/runtimetest/main.go index eba21324e..b46536ea2 100644 --- a/cmd/runtimetest/main.go +++ b/cmd/runtimetest/main.go @@ -236,13 +236,13 @@ func (c *complianceTester) validateLinuxProcess(spec *rspec.Spec) error { args := bytes.Split(bytes.Trim(cmdlineBytes, "\x00"), []byte("\x00")) c.harness.Ok(len(args) == len(spec.Process.Args), "has expected number of process arguments") - _ = c.harness.YAML(map[string]interface{}{ + _ = c.harness.YAML(map[string]any{ "expected": spec.Process.Args, "actual": args, }) for i, a := range args { c.harness.Ok(string(a) == spec.Process.Args[i], fmt.Sprintf("has expected process argument %d", i)) - _ = c.harness.YAML(map[string]interface{}{ + _ = c.harness.YAML(map[string]any{ "index": i, "expected": spec.Process.Args[i], "actual": string(a), @@ -362,7 +362,7 @@ func (c *complianceTester) validateRlimits(spec *rspec.Spec) error { if err != nil { return err } - _ = c.harness.YAML(map[string]interface{}{ + _ = c.harness.YAML(map[string]any{ "level": rfcError.Level.String(), "reference": rfcError.Reference, "type": r.Type, @@ -374,7 +374,7 @@ func (c *complianceTester) validateRlimits(spec *rspec.Spec) error { if err != nil { return err } - _ = c.harness.YAML(map[string]interface{}{ + _ = c.harness.YAML(map[string]any{ "level": rfcError.Level.String(), "reference": rfcError.Reference, "type": r.Type, @@ -392,7 +392,7 @@ func (c *complianceTester) validateSysctls(spec *rspec.Spec) error { } for k, v := range spec.Linux.Sysctl { - keyPath := filepath.Join("/proc/sys", strings.Replace(k, ".", "/", -1)) + keyPath := filepath.Join("/proc/sys", strings.ReplaceAll(k, ".", "/")) vBytes, err := os.ReadFile(keyPath) if err != nil { return err @@ -454,9 +454,10 @@ func testFileReadAccess(path string) (readable bool, err error) { defer f.Close() b := make([]byte, 1) _, err = f.Read(b) - if err == nil { + switch err { + case nil: return true, nil - } else if err == io.EOF { + case io.EOF: // Our validation/ tests only use non-empty files for read-access // tests. So if we get an EOF on the first read, the runtime did // successfully block readability. @@ -727,7 +728,7 @@ func (c *complianceTester) validateDevice(device *rspec.LinuxDevice, condition s if err != nil { return err } - _ = c.harness.YAML(map[string]interface{}{ + _ = c.harness.YAML(map[string]any{ "level": rfcError.Level.String(), "reference": rfcError.Reference, "path": device.Path, @@ -738,7 +739,7 @@ func (c *complianceTester) validateDevice(device *rspec.LinuxDevice, condition s if err != nil { return err } - _ = c.harness.YAML(map[string]interface{}{ + _ = c.harness.YAML(map[string]any{ "level": rfcError.Level.String(), "reference": rfcError.Reference, "path": device.Path, @@ -756,7 +757,7 @@ func (c *complianceTester) validateDevice(device *rspec.LinuxDevice, condition s if err != nil { return err } - _ = c.harness.YAML(map[string]interface{}{ + _ = c.harness.YAML(map[string]any{ "level": rfcError.Level.String(), "reference": rfcError.Reference, "path": device.Path, @@ -777,7 +778,7 @@ func (c *complianceTester) validateDevice(device *rspec.LinuxDevice, condition s if err != nil { return err } - _ = c.harness.YAML(map[string]interface{}{ + _ = c.harness.YAML(map[string]any{ "level": rfcError.Level.String(), "reference": rfcError.Reference, "path": device.Path, @@ -793,7 +794,7 @@ func (c *complianceTester) validateDevice(device *rspec.LinuxDevice, condition s if err != nil { return err } - _ = c.harness.YAML(map[string]interface{}{ + _ = c.harness.YAML(map[string]any{ "level": rfcError.Level.String(), "reference": rfcError.Reference, "path": device.Path, @@ -838,7 +839,7 @@ func (c *complianceTester) validateDefaultSymlinks(spec *rspec.Spec) error { if err != nil { return err } - _ = c.harness.YAML(map[string]interface{}{ + _ = c.harness.YAML(map[string]any{ "level": rfcError.Level.String(), "reference": rfcError.Reference, "path": symlink, @@ -991,7 +992,7 @@ func (c *complianceTester) validateOOMScoreAdj(spec *rspec.Spec) error { if err != nil { return err } - _ = c.harness.YAML(map[string]interface{}{ + _ = c.harness.YAML(map[string]any{ "level": rfcError.Level.String(), "reference": rfcError.Reference, "expected": expected, @@ -1052,7 +1053,7 @@ func (c *complianceTester) validateIDMappings(mappings []rspec.LinuxIDMapping, p return err } c.harness.Ok(len(idMaps) == len(mappings), fmt.Sprintf("%s has expected number of mappings", path)) - _ = c.harness.YAML(map[string]interface{}{ + _ = c.harness.YAML(map[string]any{ "expected": mappings, "actual": idMaps, }) @@ -1185,13 +1186,13 @@ func (c *complianceTester) validatePosixMounts(spec *rspec.Spec) error { } else { rfcError, err = c.Ok(foundInOrder, specerror.MountsInOrder, spec.Version, fmt.Sprintf("mounts[%d] (%s) found in order", i, configMount.Destination)) } - _ = c.harness.YAML(map[string]interface{}{ + _ = c.harness.YAML(map[string]any{ "level": rfcError.Level.String(), "reference": rfcError.Reference, "config": configMount, "indexConfig": i, "indexSystem": configSys[i], - "earlier": map[string]interface{}{ + "earlier": map[string]any{ "config": spec.Mounts[highestMatchedConfig], "indexConfig": highestMatchedConfig, "indexSystem": configSys[highestMatchedConfig], @@ -1310,10 +1311,11 @@ func run(context *cli.Context) error { } validations := defaultValidations - if platform == "linux" { + switch platform { + case "linux": validations = append(validations, posixValidations...) validations = append(validations, linuxValidations...) - } else if platform == "solaris" { + case "solaris": validations = append(validations, posixValidations...) } diff --git a/generate/generate.go b/generate/generate.go index ae5a9984b..16e8f5cd7 100644 --- a/generate/generate.go +++ b/generate/generate.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "os" + "slices" "strings" "github.com/moby/sys/capability" @@ -88,7 +89,8 @@ func New(os string) (generator Generator, err error) { } } - if os == "linux" { + switch os { + case "linux": config.Process.Capabilities = &rspec.LinuxCapabilities{ Bounding: []string{ "CAP_CHOWN", @@ -237,7 +239,7 @@ func New(os string) (generator Generator, err error) { }, Seccomp: seccomp.DefaultProfile(&config), } - } else if os == "freebsd" { + case "freebsd": config.Mounts = []rspec.Mount{ { Destination: "/dev", @@ -593,12 +595,10 @@ func (g *Generator) ClearProcessAdditionalGids() { } // AddProcessAdditionalGid adds an additional gid into g.Config.Process.AdditionalGids. -func (g *Generator) AddProcessAdditionalGid(gid uint32) { +func (g *Generator) AddProcessAdditionalGid(gid uint32) { //nolint:staticcheck // Ignore ST1003: method AddProcessAdditionalGid should be AddProcessAdditionalGID g.initConfigProcess() - for _, group := range g.Config.Process.User.AdditionalGids { - if group == gid { - return - } + if slices.Contains(g.Config.Process.User.AdditionalGids, gid) { + return } g.Config.Process.User.AdditionalGids = append(g.Config.Process.User.AdditionalGids, gid) } @@ -868,7 +868,7 @@ func (g *Generator) DropLinuxResourcesHugepageLimit(pageSize string) { } } -// AddLinuxResourcesUnified sets the g.Config.Linux.Resources.Unified +// SetLinuxResourcesUnified sets the g.Config.Linux.Resources.Unified. func (g *Generator) SetLinuxResourcesUnified(unified map[string]string) { g.initConfigLinuxResourcesUnified() for k, v := range unified { diff --git a/generate/seccomp/seccomp_default.go b/generate/seccomp/seccomp_default.go index 12aa482c2..64ec8a1fa 100644 --- a/generate/seccomp/seccomp_default.go +++ b/generate/seccomp/seccomp_default.go @@ -3,7 +3,6 @@ package seccomp import ( "runtime" - "github.com/opencontainers/runtime-spec/specs-go" rspec "github.com/opencontainers/runtime-spec/specs-go" ) @@ -31,7 +30,7 @@ func arches() []rspec.Arch { } // DefaultProfile defines the whitelist for the default seccomp profile. -func DefaultProfile(rs *specs.Spec) *rspec.LinuxSeccomp { +func DefaultProfile(rs *rspec.Spec) *rspec.LinuxSeccomp { syscalls := []rspec.LinuxSyscall{ { Names: []string{ diff --git a/generate/seccomp/seccomp_default_linux.go b/generate/seccomp/seccomp_default_linux.go index 5ca9a6dae..aac5c2bbe 100644 --- a/generate/seccomp/seccomp_default_linux.go +++ b/generate/seccomp/seccomp_default_linux.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package seccomp diff --git a/generate/seccomp/seccomp_default_unsupported.go b/generate/seccomp/seccomp_default_unsupported.go index b8c1bc26e..a8d582672 100644 --- a/generate/seccomp/seccomp_default_unsupported.go +++ b/generate/seccomp/seccomp_default_unsupported.go @@ -1,5 +1,4 @@ //go:build !linux -// +build !linux package seccomp diff --git a/validate/validate.go b/validate/validate.go index fdb3916a2..48fb52caa 100644 --- a/validate/validate.go +++ b/validate/validate.go @@ -11,6 +11,7 @@ import ( "reflect" "regexp" "runtime" + "slices" "strings" "unicode" "unicode/utf8" @@ -440,7 +441,7 @@ func (v *Validator) CheckCapabilities() (errs error) { if effective && !permitted { errs = multierror.Append(errs, fmt.Errorf("effective capability %q is not allowed, as it's not permitted", capability)) } - if ambient && !(permitted && inheritable) { + if ambient && !(permitted && inheritable) { //nolint:staticcheck // Ignore QF1001: could apply De Morgan's law. errs = multierror.Append(errs, fmt.Errorf("ambient capability %q is not allowed, as it's not permitted and inheribate", capability)) } } @@ -718,21 +719,18 @@ func (v *Validator) rlimitValid(rlimit rspec.POSIXRlimit) (errs error) { errs = multierror.Append(errs, fmt.Errorf("hard limit of rlimit %s should not be less than soft limit", rlimit.Type)) } - if v.platform == "linux" { - for _, val := range linuxRlimits { - if val == rlimit.Type { - return - } + switch v.platform { + case "linux": + if slices.Contains(linuxRlimits, rlimit.Type) { + return } errs = multierror.Append(errs, specerror.NewError(specerror.PosixProcRlimitsTypeValueError, fmt.Errorf("rlimit type %q may not be valid", rlimit.Type), v.spec.Version)) - } else if v.platform == "solaris" { - for _, val := range posixRlimits { - if val == rlimit.Type { - return - } + case "solaris": + if slices.Contains(posixRlimits, rlimit.Type) { + return } errs = multierror.Append(errs, specerror.NewError(specerror.PosixProcRlimitsTypeValueError, fmt.Errorf("rlimit type %q may not be valid", rlimit.Type), v.spec.Version)) - } else { + default: logrus.Warnf("process.rlimits validation not yet implemented for platform %q", v.platform) } @@ -787,7 +785,7 @@ func checkMandatoryUnit(field reflect.Value, tagField reflect.StructField, paren return } -func checkMandatory(obj interface{}) (errs error) { +func checkMandatory(obj any) (errs error) { objT := reflect.TypeOf(obj) objV := reflect.ValueOf(obj) if isStructPtr(objT) { diff --git a/validate/validate_linux.go b/validate/validate_linux.go index 9aaff1207..2c7cdb750 100644 --- a/validate/validate_linux.go +++ b/validate/validate_linux.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package validate diff --git a/validate/validate_unsupported.go b/validate/validate_unsupported.go index 2ffa8811a..0d1836b4a 100644 --- a/validate/validate_unsupported.go +++ b/validate/validate_unsupported.go @@ -1,5 +1,4 @@ //go:build !linux -// +build !linux package validate diff --git a/validation/hostname/hostname.go b/validation/hostname/hostname.go index 02e01754f..670afed00 100644 --- a/validation/hostname/hostname.go +++ b/validation/hostname/hostname.go @@ -30,7 +30,7 @@ func main() { t.Header(0) defer t.AutoPlan() - if "linux" != runtime.GOOS { + if runtime.GOOS != "linux" { t.Skip(1, "linux-specific namespace test") } diff --git a/validation/linux_cgroups_blkio/linux_cgroups_blkio.go b/validation/linux_cgroups_blkio/linux_cgroups_blkio.go index 5b335f509..0004613ae 100644 --- a/validation/linux_cgroups_blkio/linux_cgroups_blkio.go +++ b/validation/linux_cgroups_blkio/linux_cgroups_blkio.go @@ -50,7 +50,7 @@ func testBlkioCgroups(rate uint64, isEmpty bool) error { } func main() { - if "linux" != runtime.GOOS { + if runtime.GOOS != "linux" { util.Fatal(fmt.Errorf("linux-specific cgroup test")) } diff --git a/validation/linux_cgroups_cpus/linux_cgroups_cpus.go b/validation/linux_cgroups_cpus/linux_cgroups_cpus.go index a13707580..ca92d4504 100644 --- a/validation/linux_cgroups_cpus/linux_cgroups_cpus.go +++ b/validation/linux_cgroups_cpus/linux_cgroups_cpus.go @@ -119,7 +119,7 @@ func testEmptyCPU() error { } func main() { - if "linux" != runtime.GOOS { + if runtime.GOOS != "linux" { util.Fatal(fmt.Errorf("linux-specific cgroup test")) } diff --git a/validation/linux_cgroups_hugetlb/linux_cgroups_hugetlb.go b/validation/linux_cgroups_hugetlb/linux_cgroups_hugetlb.go index 154b87362..5aa2a078b 100644 --- a/validation/linux_cgroups_hugetlb/linux_cgroups_hugetlb.go +++ b/validation/linux_cgroups_hugetlb/linux_cgroups_hugetlb.go @@ -88,7 +88,7 @@ func testWrongHugetlb() error { } func main() { - if "linux" != runtime.GOOS { + if runtime.GOOS != "linux" { util.Fatal(fmt.Errorf("linux-specific cgroup test")) } diff --git a/validation/linux_cgroups_memory/linux_cgroups_memory.go b/validation/linux_cgroups_memory/linux_cgroups_memory.go index 89e88bd7f..e83be6756 100644 --- a/validation/linux_cgroups_memory/linux_cgroups_memory.go +++ b/validation/linux_cgroups_memory/linux_cgroups_memory.go @@ -10,7 +10,7 @@ import ( ) func main() { - if "linux" != runtime.GOOS { + if runtime.GOOS != "linux" { util.Fatal(fmt.Errorf("linux-specific cgroup test")) } diff --git a/validation/linux_cgroups_network/linux_cgroups_network.go b/validation/linux_cgroups_network/linux_cgroups_network.go index f91cf9867..6208cd7cb 100644 --- a/validation/linux_cgroups_network/linux_cgroups_network.go +++ b/validation/linux_cgroups_network/linux_cgroups_network.go @@ -98,7 +98,7 @@ func testNetworkCgroups() error { } func main() { - if "linux" != runtime.GOOS { + if runtime.GOOS != "linux" { util.Fatal(fmt.Errorf("linux-specific cgroup test")) } diff --git a/validation/linux_cgroups_relative_cpus/linux_cgroups_relative_cpus.go b/validation/linux_cgroups_relative_cpus/linux_cgroups_relative_cpus.go index 290860750..b0dff5046 100644 --- a/validation/linux_cgroups_relative_cpus/linux_cgroups_relative_cpus.go +++ b/validation/linux_cgroups_relative_cpus/linux_cgroups_relative_cpus.go @@ -8,10 +8,12 @@ import ( ) func main() { - var shares uint64 = 1024 - var period uint64 = 100000 - var quota int64 = 50000 - var cpus, mems string = "0-1", "0" + const ( + shares uint64 = 1024 + period uint64 = 100000 + quota int64 = 50000 + cpus, mems = "0-1", "0" + ) t := tap.New() t.Header(0) diff --git a/validation/linux_ns_itype/linux_ns_itype.go b/validation/linux_ns_itype/linux_ns_itype.go index 1b08b458b..662d2aeca 100644 --- a/validation/linux_ns_itype/linux_ns_itype.go +++ b/validation/linux_ns_itype/linux_ns_itype.go @@ -118,7 +118,7 @@ func main() { t := tap.New() t.Header(0) - if "linux" != runtime.GOOS { + if runtime.GOOS != "linux" { t.Skip(1, "linux-specific namespace test") } diff --git a/validation/linux_ns_nopath/linux_ns_nopath.go b/validation/linux_ns_nopath/linux_ns_nopath.go index 7aea78d01..9e1fbc819 100644 --- a/validation/linux_ns_nopath/linux_ns_nopath.go +++ b/validation/linux_ns_nopath/linux_ns_nopath.go @@ -119,7 +119,7 @@ func main() { t := tap.New() t.Header(0) - if "linux" != runtime.GOOS { + if runtime.GOOS != "linux" { t.Skip(1, "linux-specific namespace test") } diff --git a/validation/linux_ns_path/linux_ns_path.go b/validation/linux_ns_path/linux_ns_path.go index 8744fb592..9e4d2f04e 100644 --- a/validation/linux_ns_path/linux_ns_path.go +++ b/validation/linux_ns_path/linux_ns_path.go @@ -148,7 +148,7 @@ func main() { } for _, c := range cases { - if "linux" != runtime.GOOS { + if runtime.GOOS != "linux" { t.Skip(1, fmt.Sprintf("linux-specific namespace test: %s", c)) } diff --git a/validation/linux_ns_path_type/linux_ns_path_type.go b/validation/linux_ns_path_type/linux_ns_path_type.go index 82846831f..99b18b205 100644 --- a/validation/linux_ns_path_type/linux_ns_path_type.go +++ b/validation/linux_ns_path_type/linux_ns_path_type.go @@ -93,7 +93,7 @@ func main() { } for _, c := range cases { - if "linux" != runtime.GOOS { + if runtime.GOOS != "linux" { t.Skip(1, fmt.Sprintf("linux-specific namespace test: %s", c)) } diff --git a/validation/misc_props/misc_props.go b/validation/misc_props/misc_props.go index d46404270..6524f5e62 100644 --- a/validation/misc_props/misc_props.go +++ b/validation/misc_props/misc_props.go @@ -14,7 +14,7 @@ import ( "github.com/opencontainers/runtime-tools/validation/util" ) -func saveConfig(path string, v interface{}) error { +func saveConfig(path string, v any) error { data, err := json.Marshal(v) if err != nil { return err diff --git a/validation/process_capabilities/process_capabilities.go b/validation/process_capabilities/process_capabilities.go index 5e71cd13e..4be5b7c8d 100644 --- a/validation/process_capabilities/process_capabilities.go +++ b/validation/process_capabilities/process_capabilities.go @@ -8,7 +8,7 @@ import ( ) func main() { - if "linux" != runtime.GOOS { + if runtime.GOOS != "linux" { util.Skip("linux-specific process.capabilities test", map[string]string{"OS": runtime.GOOS}) os.Exit(0) } diff --git a/validation/process_capabilities_fail/process_capabilities_fail.go b/validation/process_capabilities_fail/process_capabilities_fail.go index 21c94f32b..a1a524bbf 100644 --- a/validation/process_capabilities_fail/process_capabilities_fail.go +++ b/validation/process_capabilities_fail/process_capabilities_fail.go @@ -11,7 +11,7 @@ import ( ) func main() { - if "linux" != runtime.GOOS { + if runtime.GOOS != "linux" { util.Skip("linux-specific process.capabilities test", map[string]string{"OS": runtime.GOOS}) os.Exit(0) } diff --git a/validation/process_rlimits/process_rlimits.go b/validation/process_rlimits/process_rlimits.go index 9f22382cb..21e8d4cb8 100644 --- a/validation/process_rlimits/process_rlimits.go +++ b/validation/process_rlimits/process_rlimits.go @@ -8,7 +8,7 @@ import ( ) func main() { - if "linux" != runtime.GOOS && "solaris" != runtime.GOOS { + if runtime.GOOS != "linux" && runtime.GOOS != "solaris" { util.Skip("POSIX-specific process.rlimits test", map[string]string{"OS": runtime.GOOS}) os.Exit(0) } diff --git a/validation/process_rlimits_fail/process_rlimits_fail.go b/validation/process_rlimits_fail/process_rlimits_fail.go index bf1584b6a..772557ce0 100644 --- a/validation/process_rlimits_fail/process_rlimits_fail.go +++ b/validation/process_rlimits_fail/process_rlimits_fail.go @@ -11,7 +11,7 @@ import ( ) func main() { - if "linux" != runtime.GOOS && "solaris" != runtime.GOOS { + if runtime.GOOS != "linux" && runtime.GOOS != "solaris" { util.Skip("POSIX-specific process.rlimits test", map[string]string{"OS": runtime.GOOS}) os.Exit(0) } diff --git a/validation/root_readonly_true/root_readonly_true.go b/validation/root_readonly_true/root_readonly_true.go index 74229d32e..881e32ae3 100644 --- a/validation/root_readonly_true/root_readonly_true.go +++ b/validation/root_readonly_true/root_readonly_true.go @@ -8,7 +8,7 @@ import ( ) func main() { - if "windows" == runtime.GOOS { + if runtime.GOOS == "windows" { util.Skip("non-Windows root.readonly test", map[string]string{"OS": runtime.GOOS}) os.Exit(0) } diff --git a/validation/util/test.go b/validation/util/test.go index 626499e65..bdfcdf293 100644 --- a/validation/util/test.go +++ b/validation/util/test.go @@ -92,7 +92,7 @@ func Fatal(err error) { } // Skip skips a full TAP suite. -func Skip(message string, diagnostic interface{}) { +func Skip(message string, diagnostic any) { t := tap.New() t.Header(1) t.Skip(1, message)