diff options
author | Julien Dessaux | 2024-06-02 01:17:36 +0200 |
---|---|---|
committer | Julien Dessaux | 2024-06-02 01:17:36 +0200 |
commit | 4a254746de7246ddf8ac131f734f224d49e927b7 (patch) | |
tree | e7b33fb7769864ed7528ae9fe1f59a6a61012351 /pkg/files.go | |
parent | fix(gonf): fixed hostflag management (diff) | |
download | gonf-4a254746de7246ddf8ac131f734f224d49e927b7.tar.gz gonf-4a254746de7246ddf8ac131f734f224d49e927b7.tar.bz2 gonf-4a254746de7246ddf8ac131f734f224d49e927b7.zip |
chore(gonf): removed opinionated static checkers
Diffstat (limited to '')
-rw-r--r-- | pkg/files.go | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/pkg/files.go b/pkg/files.go index 2fe0f6e..b9e7e5c 100644 --- a/pkg/files.go +++ b/pkg/files.go @@ -139,16 +139,12 @@ func resolveFiles() (status Status) { return } -func sha256sumOfFile(filename string) (hash []byte, err error) { +func sha256sumOfFile(filename string) ([]byte, error) { f, err := os.Open(filename) if err != nil { return nil, err } - defer func() { - if e := f.Close(); err == nil { - err = e - } - }() + defer f.Close() h := sha256.New() if _, err := io.Copy(h, f); err != nil { return nil, err @@ -156,16 +152,12 @@ func sha256sumOfFile(filename string) (hash []byte, err error) { return h.Sum(nil), nil } -func writeFile(filename string, contents []byte) (err error) { +func writeFile(filename string, contents []byte) error { f, err := os.Create(filename) if err != nil { return err } - defer func() { - if e := f.Close(); err == nil { - err = e - } - }() + defer f.Close() _, err = f.Write(contents) return err } |