Skip to content

Commit c6b8fa3

Browse files
committed
gof(ump)t code
format the code with gofumpt (which is a superset of gofmt) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent e931285 commit c6b8fa3

File tree

29 files changed

+57
-63
lines changed

29 files changed

+57
-63
lines changed

cgroups/cgroups.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func FindCgroup() (Cgroup, error) {
6161
} else if postSeparatorFields[0] == "cgroup2" {
6262
cgroupv2 = true
6363
continue
64-
//TODO cgroupv2 unimplemented
64+
// TODO cgroupv2 unimplemented
6565
}
6666
}
6767

cmd/oci-runtime-tool/generate.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,10 +1223,11 @@ var cgroupDeviceType = map[string]bool{
12231223
"b": true, // block device
12241224
"c": true, // character device
12251225
}
1226+
12261227
var cgroupDeviceAccess = map[string]bool{
1227-
"r": true, //read
1228-
"w": true, //write
1229-
"m": true, //mknod
1228+
"r": true, // read
1229+
"w": true, // write
1230+
"m": true, // mknod
12301231
}
12311232

12321233
// parseLinuxResourcesDeviceAccess parses the raw string passed with the --device-access-add flag
@@ -1448,12 +1449,12 @@ func parseEnv(env string) (string, string, error) {
14481449

14491450
// parseEnvFile reads a file with environment variables enumerated by lines
14501451
//
1451-
// ``Environment variable names used by the utilities in the Shell and
1452+
// Environment variable names used by the utilities in the Shell and
14521453
// Utilities volume of IEEE Std 1003.1-2001 consist solely of uppercase
14531454
// letters, digits, and the '_' (underscore) from the characters defined in
14541455
// Portable Character Set and do not begin with a digit. *But*, other
14551456
// characters may be permitted by an implementation; applications shall
1456-
// tolerate the presence of such names.''
1457+
// tolerate the presence of such names.
14571458
// -- http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html
14581459
//
14591460
// As of #16585, it's up to application inside docker to validate or not
@@ -1495,7 +1496,6 @@ func parseEnvFile(filename string) ([]string, error) {
14951496
}
14961497

14971498
if len(data) > 1 {
1498-
14991499
// pass the value through, no trimming
15001500
lines = append(lines, fmt.Sprintf("%s=%s", variable, data[1]))
15011501
} else {

cmd/runtimetest/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ func testDirectoryWriteAccess(path string) (writable bool, err error) {
501501
}
502502

503503
func testFileWriteAccess(path string) (readable bool, err error) {
504-
err = os.WriteFile(path, []byte("a"), 0644)
504+
err = os.WriteFile(path, []byte("a"), 0o644)
505505
if err == nil {
506506
return true, nil
507507
}
@@ -1143,10 +1143,10 @@ func (c *complianceTester) validatePosixMounts(spec *rspec.Spec) error {
11431143
}
11441144

11451145
var mountErrs error
1146-
var configSys = make(map[int]int)
1147-
var consumedSys = make(map[int]bool)
1146+
configSys := make(map[int]int)
1147+
consumedSys := make(map[int]bool)
11481148
highestMatchedConfig := -1
1149-
var j = 0
1149+
j := 0
11501150
for i, configMount := range spec.Mounts {
11511151
if configMount.Type == "bind" || configMount.Type == "rbind" {
11521152
c.harness.Todo().Fail("we need an (r)bind spec to test against")

generate/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func createEnvCacheMap(env []string) map[string]int {
323323
//
324324
// Deprecated: Replace with:
325325
//
326-
// Use generator.Config = config
326+
// Use generator.Config = config
327327
func (g *Generator) SetSpec(config *rspec.Spec) {
328328
g.Config = config
329329
}

generate/generate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestGenerateValid(t *testing.T) {
3838

3939
// Create our toy bundle.
4040
rootfsPath := filepath.Join(bundle, "rootfs")
41-
if err := os.Mkdir(rootfsPath, 0755); err != nil {
41+
if err := os.Mkdir(rootfsPath, 0o755); err != nil {
4242
t.Fatal(err)
4343
}
4444
configPath := filepath.Join(bundle, "config.json")

generate/seccomp/parse_action.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ type SyscallOpts struct {
2323
func ParseSyscallFlag(args SyscallOpts, config *rspec.LinuxSeccomp) error {
2424
var arguments []string
2525
if args.Index != "" && args.Value != "" && args.ValueTwo != "" && args.Operator != "" {
26-
arguments = []string{args.Action, args.Syscall, args.Index, args.Value,
27-
args.ValueTwo, args.Operator}
26+
arguments = []string{
27+
args.Action, args.Syscall, args.Index, args.Value,
28+
args.ValueTwo, args.Operator,
29+
}
2830
} else {
2931
arguments = []string{args.Action, args.Syscall}
3032
}

generate/seccomp/seccomp_default.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ func arches() []rspec.Arch {
3232

3333
// DefaultProfile defines the whitelist for the default seccomp profile.
3434
func DefaultProfile(rs *specs.Spec) *rspec.LinuxSeccomp {
35-
3635
syscalls := []rspec.LinuxSyscall{
3736
{
3837
Names: []string{
@@ -535,7 +534,6 @@ func DefaultProfile(rs *specs.Spec) *rspec.LinuxSeccomp {
535534
},
536535
},
537536
}...)
538-
539537
}
540538

541539
arch := runtime.GOARCH

specerror/bundle.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ const (
1616
ArtifactsInSingleDir
1717
)
1818

19-
var (
20-
containerFormatRef = func(version string) (reference string, err error) {
21-
return fmt.Sprintf(referenceTemplate, version, "bundle.md#container-format"), nil
22-
}
23-
)
19+
var containerFormatRef = func(version string) (reference string, err error) {
20+
return fmt.Sprintf(referenceTemplate, version, "bundle.md#container-format"), nil
21+
}
2422

2523
func init() {
2624
register(ConfigInRootBundleDir, rfc2119.Must, containerFormatRef)

specerror/runtime-linux.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ const (
1212
DefaultRuntimeLinuxSymlinks Code = 0xf001 + iota
1313
)
1414

15-
var (
16-
devSymbolicLinksRef = func(version string) (reference string, err error) {
17-
return fmt.Sprintf(referenceTemplate, version, "runtime-linux.md#dev-symbolic-links"), nil
18-
}
19-
)
15+
var devSymbolicLinksRef = func(version string) (reference string, err error) {
16+
return fmt.Sprintf(referenceTemplate, version, "runtime-linux.md#dev-symbolic-links"), nil
17+
}
2018

2119
func init() {
2220
register(DefaultRuntimeLinuxSymlinks, rfc2119.Must, devSymbolicLinksRef)

validate/validate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func (v *Validator) checkEventHooks(hookType string, hooks []rspec.Hook, hostSpe
298298
if err != nil {
299299
errs = multierror.Append(errs, fmt.Errorf("cannot find %s hook: %v", hookType, hook.Path))
300300
}
301-
if fi.Mode()&0111 == 0 {
301+
if fi.Mode()&0o111 == 0 {
302302
errs = multierror.Append(errs, fmt.Errorf("the %s hook %v: is not executable", hookType, hook.Path))
303303
}
304304
}
@@ -358,7 +358,7 @@ func (v *Validator) CheckProcess() (errs error) {
358358
errs = multierror.Append(errs, err)
359359
} else {
360360
m := fileinfo.Mode()
361-
if m.IsDir() || m&0111 == 0 {
361+
if m.IsDir() || m&0o111 == 0 {
362362
errs = multierror.Append(errs, fmt.Errorf("arg %q is not executable", process.Args[0]))
363363
}
364364
}

0 commit comments

Comments
 (0)