Skip to content

Commit 74788a3

Browse files
committed
fileperms: newer Go 1.13+ octal literal format
Problem: While removing cgroupsv1 code, I noticed my neovim Go config automatically changed fileperms to the new octal format and I didn't want that polluting my diffs. Decision: I thought it best to switch to the new octal format in a dedicated PR. Action: - Cursor switched to new octal format for all fileperm ocurrences in Go source and test files. - vendor/, docs/ and non-Go files were ignored. - Reviewed manually. Ref: https://go.dev/ref/spec#Go_1.13 Signed-off-by: Lokesh Mandvekar <[email protected]>
1 parent ab7abba commit 74788a3

File tree

94 files changed

+382
-382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+382
-382
lines changed

cmd/podman/common/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func ParseBuildOpts(cmd *cobra.Command, args []string, buildOpts *BuildFlagsWrap
249249
var logFile *os.File
250250
if cmd.Flag("logfile").Changed {
251251
var err error
252-
logFile, err = os.OpenFile(buildOpts.Logfile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0600)
252+
logFile, err = os.OpenFile(buildOpts.Logfile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0o600)
253253
if err != nil {
254254
return nil, err
255255
}

cmd/podman/containers/commit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func commit(_ *cobra.Command, args []string) error {
116116
return err
117117
}
118118
if len(iidFile) > 0 {
119-
if err = os.WriteFile(iidFile, []byte(response.Id), 0644); err != nil {
119+
if err = os.WriteFile(iidFile, []byte(response.Id), 0o644); err != nil {
120120
return fmt.Errorf("failed to write image ID: %w", err)
121121
}
122122
}

cmd/podman/containers/export.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func export(_ *cobra.Command, args []string) error {
8181
}
8282
// open file here with O_WRONLY since on MacOS it can fail to open /dev/stderr in read mode for example
8383
// https://github.com/containers/podman/issues/16870
84-
file, err := os.OpenFile(outputFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
84+
file, err := os.OpenFile(outputFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o644)
8585
if err != nil {
8686
return err
8787
}

cmd/podman/early_init_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func setRLimits() error {
2121

2222
func setUMask() {
2323
// Be sure we can create directories with 0755 mode.
24-
syscall.Umask(0022)
24+
syscall.Umask(0o022)
2525
}
2626

2727
func earlyInitHook() {

cmd/podman/generate/spec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func spec(_ *cobra.Command, args []string) error {
5959
// if we are looking to print the output, do not mess it up by printing the path
6060
// if we are using -v the user probably expects to pipe the output somewhere else
6161
if len(opts.FileName) > 0 {
62-
err = os.WriteFile(opts.FileName, report.Data, 0644)
62+
err = os.WriteFile(opts.FileName, report.Data, 0o644)
6363
if err != nil {
6464
return err
6565
}

cmd/podman/images/utils_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func setupPipe() (string, func() <-chan error, error) {
2020
return "", nil, err
2121
}
2222
pipePath := filepath.Join(pipeDir, "saveio")
23-
err = unix.Mkfifo(pipePath, 0600)
23+
err = unix.Mkfifo(pipePath, 0o600)
2424
if err != nil {
2525
if e := os.RemoveAll(pipeDir); e != nil {
2626
logrus.Errorf("Removing named pipe: %q", e)

cmd/podman/kube/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func generateKube(cmd *cobra.Command, args []string) error {
109109
if err := fileutils.Exists(generateFile); err == nil {
110110
return fmt.Errorf("cannot write to %q; file exists", generateFile)
111111
}
112-
if err := os.WriteFile(generateFile, content, 0644); err != nil {
112+
if err := os.WriteFile(generateFile, content, 0o644); err != nil {
113113
return fmt.Errorf("cannot write to %q: %w", generateFile, err)
114114
}
115115
return nil

cmd/podman/manifest/push.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func push(cmd *cobra.Command, args []string) error {
170170
return err
171171
}
172172
if manifestPushOpts.DigestFile != "" {
173-
if err := os.WriteFile(manifestPushOpts.DigestFile, []byte(digest), 0644); err != nil {
173+
if err := os.WriteFile(manifestPushOpts.DigestFile, []byte(digest), 0o644); err != nil {
174174
return err
175175
}
176176
}

cmd/podman/system/service.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func service(cmd *cobra.Command, args []string) error {
111111
if err := syscall.Unlink(uri.Path); err != nil && !os.IsNotExist(err) {
112112
return err
113113
}
114-
mask := syscall.Umask(0177)
114+
mask := syscall.Umask(0o177)
115115
defer syscall.Umask(mask)
116116
}
117117
}
@@ -162,12 +162,12 @@ func resolveAPIURI(uri []string) (string, error) {
162162

163163
socketName := "podman.sock"
164164
socketPath := filepath.Join(xdg, "podman", socketName)
165-
if err := os.MkdirAll(filepath.Dir(socketPath), 0700); err != nil {
165+
if err := os.MkdirAll(filepath.Dir(socketPath), 0o700); err != nil {
166166
return "", err
167167
}
168168
return "unix://" + socketPath, nil
169169
default:
170-
if err := os.MkdirAll(filepath.Dir(registry.DefaultRootAPIPath), 0700); err != nil {
170+
if err := os.MkdirAll(filepath.Dir(registry.DefaultRootAPIPath), 0o700); err != nil {
171171
return "", err
172172
}
173173
return registry.DefaultRootAPIAddress, nil

cmd/quadlet/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func logToKmsg(s string) bool {
5151
}
5252

5353
if kmsgFile == nil {
54-
f, err := os.OpenFile("/dev/kmsg", os.O_WRONLY, 0644)
54+
f, err := os.OpenFile("/dev/kmsg", os.O_WRONLY, 0o644)
5555
if err != nil {
5656
noKmsg = true
5757
return false

0 commit comments

Comments
 (0)