@@ -236,13 +236,13 @@ func (c *complianceTester) validateLinuxProcess(spec *rspec.Spec) error {
236236
237237 args := bytes .Split (bytes .Trim (cmdlineBytes , "\x00 " ), []byte ("\x00 " ))
238238 c .harness .Ok (len (args ) == len (spec .Process .Args ), "has expected number of process arguments" )
239- _ = c .harness .YAML (map [string ]interface {} {
239+ _ = c .harness .YAML (map [string ]any {
240240 "expected" : spec .Process .Args ,
241241 "actual" : args ,
242242 })
243243 for i , a := range args {
244244 c .harness .Ok (string (a ) == spec .Process .Args [i ], fmt .Sprintf ("has expected process argument %d" , i ))
245- _ = c .harness .YAML (map [string ]interface {} {
245+ _ = c .harness .YAML (map [string ]any {
246246 "index" : i ,
247247 "expected" : spec .Process .Args [i ],
248248 "actual" : string (a ),
@@ -362,7 +362,7 @@ func (c *complianceTester) validateRlimits(spec *rspec.Spec) error {
362362 if err != nil {
363363 return err
364364 }
365- _ = c .harness .YAML (map [string ]interface {} {
365+ _ = c .harness .YAML (map [string ]any {
366366 "level" : rfcError .Level .String (),
367367 "reference" : rfcError .Reference ,
368368 "type" : r .Type ,
@@ -374,7 +374,7 @@ func (c *complianceTester) validateRlimits(spec *rspec.Spec) error {
374374 if err != nil {
375375 return err
376376 }
377- _ = c .harness .YAML (map [string ]interface {} {
377+ _ = c .harness .YAML (map [string ]any {
378378 "level" : rfcError .Level .String (),
379379 "reference" : rfcError .Reference ,
380380 "type" : r .Type ,
@@ -392,7 +392,7 @@ func (c *complianceTester) validateSysctls(spec *rspec.Spec) error {
392392 }
393393
394394 for k , v := range spec .Linux .Sysctl {
395- keyPath := filepath .Join ("/proc/sys" , strings .Replace (k , "." , "/" , - 1 ))
395+ keyPath := filepath .Join ("/proc/sys" , strings .ReplaceAll (k , "." , "/" ))
396396 vBytes , err := os .ReadFile (keyPath )
397397 if err != nil {
398398 return err
@@ -454,9 +454,10 @@ func testFileReadAccess(path string) (readable bool, err error) {
454454 defer f .Close ()
455455 b := make ([]byte , 1 )
456456 _ , err = f .Read (b )
457- if err == nil {
457+ switch err {
458+ case nil :
458459 return true , nil
459- } else if err == io .EOF {
460+ case io .EOF :
460461 // Our validation/ tests only use non-empty files for read-access
461462 // tests. So if we get an EOF on the first read, the runtime did
462463 // successfully block readability.
@@ -727,7 +728,7 @@ func (c *complianceTester) validateDevice(device *rspec.LinuxDevice, condition s
727728 if err != nil {
728729 return err
729730 }
730- _ = c .harness .YAML (map [string ]interface {} {
731+ _ = c .harness .YAML (map [string ]any {
731732 "level" : rfcError .Level .String (),
732733 "reference" : rfcError .Reference ,
733734 "path" : device .Path ,
@@ -738,7 +739,7 @@ func (c *complianceTester) validateDevice(device *rspec.LinuxDevice, condition s
738739 if err != nil {
739740 return err
740741 }
741- _ = c .harness .YAML (map [string ]interface {} {
742+ _ = c .harness .YAML (map [string ]any {
742743 "level" : rfcError .Level .String (),
743744 "reference" : rfcError .Reference ,
744745 "path" : device .Path ,
@@ -756,7 +757,7 @@ func (c *complianceTester) validateDevice(device *rspec.LinuxDevice, condition s
756757 if err != nil {
757758 return err
758759 }
759- _ = c .harness .YAML (map [string ]interface {} {
760+ _ = c .harness .YAML (map [string ]any {
760761 "level" : rfcError .Level .String (),
761762 "reference" : rfcError .Reference ,
762763 "path" : device .Path ,
@@ -777,7 +778,7 @@ func (c *complianceTester) validateDevice(device *rspec.LinuxDevice, condition s
777778 if err != nil {
778779 return err
779780 }
780- _ = c .harness .YAML (map [string ]interface {} {
781+ _ = c .harness .YAML (map [string ]any {
781782 "level" : rfcError .Level .String (),
782783 "reference" : rfcError .Reference ,
783784 "path" : device .Path ,
@@ -793,7 +794,7 @@ func (c *complianceTester) validateDevice(device *rspec.LinuxDevice, condition s
793794 if err != nil {
794795 return err
795796 }
796- _ = c .harness .YAML (map [string ]interface {} {
797+ _ = c .harness .YAML (map [string ]any {
797798 "level" : rfcError .Level .String (),
798799 "reference" : rfcError .Reference ,
799800 "path" : device .Path ,
@@ -838,7 +839,7 @@ func (c *complianceTester) validateDefaultSymlinks(spec *rspec.Spec) error {
838839 if err != nil {
839840 return err
840841 }
841- _ = c .harness .YAML (map [string ]interface {} {
842+ _ = c .harness .YAML (map [string ]any {
842843 "level" : rfcError .Level .String (),
843844 "reference" : rfcError .Reference ,
844845 "path" : symlink ,
@@ -991,7 +992,7 @@ func (c *complianceTester) validateOOMScoreAdj(spec *rspec.Spec) error {
991992 if err != nil {
992993 return err
993994 }
994- _ = c .harness .YAML (map [string ]interface {} {
995+ _ = c .harness .YAML (map [string ]any {
995996 "level" : rfcError .Level .String (),
996997 "reference" : rfcError .Reference ,
997998 "expected" : expected ,
@@ -1052,7 +1053,7 @@ func (c *complianceTester) validateIDMappings(mappings []rspec.LinuxIDMapping, p
10521053 return err
10531054 }
10541055 c .harness .Ok (len (idMaps ) == len (mappings ), fmt .Sprintf ("%s has expected number of mappings" , path ))
1055- _ = c .harness .YAML (map [string ]interface {} {
1056+ _ = c .harness .YAML (map [string ]any {
10561057 "expected" : mappings ,
10571058 "actual" : idMaps ,
10581059 })
@@ -1185,13 +1186,13 @@ func (c *complianceTester) validatePosixMounts(spec *rspec.Spec) error {
11851186 } else {
11861187 rfcError , err = c .Ok (foundInOrder , specerror .MountsInOrder , spec .Version , fmt .Sprintf ("mounts[%d] (%s) found in order" , i , configMount .Destination ))
11871188 }
1188- _ = c .harness .YAML (map [string ]interface {} {
1189+ _ = c .harness .YAML (map [string ]any {
11891190 "level" : rfcError .Level .String (),
11901191 "reference" : rfcError .Reference ,
11911192 "config" : configMount ,
11921193 "indexConfig" : i ,
11931194 "indexSystem" : configSys [i ],
1194- "earlier" : map [string ]interface {} {
1195+ "earlier" : map [string ]any {
11951196 "config" : spec .Mounts [highestMatchedConfig ],
11961197 "indexConfig" : highestMatchedConfig ,
11971198 "indexSystem" : configSys [highestMatchedConfig ],
@@ -1310,10 +1311,11 @@ func run(context *cli.Context) error {
13101311 }
13111312
13121313 validations := defaultValidations
1313- if platform == "linux" {
1314+ switch platform {
1315+ case "linux" :
13141316 validations = append (validations , posixValidations ... )
13151317 validations = append (validations , linuxValidations ... )
1316- } else if platform == "solaris" {
1318+ case "solaris" :
13171319 validations = append (validations , posixValidations ... )
13181320 }
13191321
0 commit comments