Skip to content

Commit 457832d

Browse files
committed
chore: fix some linter warnings
Signed-off-by: Michael Adler <[email protected]>
1 parent 403e62d commit 457832d

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

oci-watcher/io.go

-11
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,6 @@ func unpackTgz(src io.Reader, destDir string, skipHidden bool) error {
6262
return nil
6363
}
6464

65-
func streamToFile(reader io.Reader, filePath string) error {
66-
file, err := os.Create(filePath)
67-
if err != nil {
68-
return err
69-
}
70-
defer file.Close()
71-
72-
_, err = io.Copy(file, reader)
73-
return err
74-
}
75-
7665
func findAppFiles(dir string) ([]string, error) {
7766
var appFiles []string
7867
err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {

oci-watcher/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var (
3131
func main() {
3232
configPath := path.Join(os.Getenv("HOME"), ".docker", "config.json")
3333
if !fileExists(configPath) {
34-
_ = os.MkdirAll(path.Dir(configPath), 0755)
34+
_ = os.MkdirAll(path.Dir(configPath), 0o755)
3535

3636
reader := bufio.NewReader(os.Stdin)
3737

@@ -52,7 +52,7 @@ func main() {
5252
}
5353
}`, encodedAuth)
5454

55-
file, err := os.OpenFile(configPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
55+
file, err := os.OpenFile(configPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600)
5656
if err != nil {
5757
log.Fatalf("Failed to create file: %v", err)
5858
}

oci-watcher/oci.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ func downloadFromOCI(url string) (io.ReadCloser, error) {
109109
if err != nil {
110110
return nil, err
111111
}
112-
reader, err := rc.BlobGet(ctx, appRef, descriptor.Descriptor{Digest: digest.Digest(sha256)})
113-
return reader, nil
112+
return rc.BlobGet(ctx, appRef, descriptor.Descriptor{Digest: digest.Digest(sha256)})
114113
}
115114

116115
func syncDeployments(ociRegistry, deployDir string) error {
@@ -140,7 +139,7 @@ func syncDeployments(ociRegistry, deployDir string) error {
140139
}
141140

142141
log.Printf("%s: fetching from remote", deployment.Name)
143-
_ = os.MkdirAll(destDir, 0755)
142+
_ = os.MkdirAll(destDir, 0o755)
144143

145144
tempDir, err := os.MkdirTemp("", deployment.Name)
146145
if err != nil {
@@ -175,7 +174,7 @@ func syncDeployments(ociRegistry, deployDir string) error {
175174
return err
176175
}
177176

178-
if err := os.WriteFile(hashFile, []byte(expectedHash), 0644); err != nil {
177+
if err := os.WriteFile(hashFile, []byte(expectedHash), 0o644); err != nil {
179178
return err
180179
}
181180

0 commit comments

Comments
 (0)