Browse code

pkg/pidfile: pkg/pidfile: use strconv instead of fmt.Sprintf(), and unconvert

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2022/10/05 23:35:26
Showing 1 changed files
... ...
@@ -36,10 +36,10 @@ func New(path string) (*PIDFile, error) {
36 36
 		return nil, err
37 37
 	}
38 38
 	// Note MkdirAll returns nil if a directory already exists
39
-	if err := system.MkdirAll(filepath.Dir(path), os.FileMode(0755)); err != nil {
39
+	if err := system.MkdirAll(filepath.Dir(path), 0o755); err != nil {
40 40
 		return nil, err
41 41
 	}
42
-	if err := os.WriteFile(path, []byte(fmt.Sprintf("%d", os.Getpid())), 0644); err != nil {
42
+	if err := os.WriteFile(path, []byte(strconv.Itoa(os.Getpid())), 0o644); err != nil {
43 43
 		return nil, err
44 44
 	}
45 45