Skip to content

Commit

Permalink
gosec warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaspin committed Oct 17, 2023
1 parent fa538ee commit def44be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cache-cli/pkg/archive/native_archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ func (a *NativeArchiver) Decompress(src string) (string, error) {
}

// #nosec
if _, err := io.Copy(outFile, tarReader); err != nil {
_, err = io.Copy(outFile, tarReader)
if err != nil {
log.Errorf("Error writing to file '%s': %v", header.Name, err)
hadError = true
_ = outFile.Close()
Expand Down
3 changes: 2 additions & 1 deletion cache-cli/pkg/files/checksum.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import (
"os"
)

// #nosec
func GenerateChecksum(filePath string) (string, error) {
// #nosec
file, err := os.Open(filePath)
if err != nil {
return "", err
}

defer file.Close()

// #nosec
hash := md5.New()
if _, err := io.Copy(hash, file); err != nil {
return "", err
Expand Down

0 comments on commit def44be

Please sign in to comment.