Skip to content

Commit

Permalink
Surpress gosec G307 on file.Close() defers
Browse files Browse the repository at this point in the history
  • Loading branch information
phamann committed Mar 9, 2020
1 parent 4e21b3f commit 02a073d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/common/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func CopyFile(src, dst string) (err error) {
if err != nil {
return fmt.Errorf("error reading source file: %w", err)
}
defer in.Close()
defer in.Close() // #nosec G307

// Create destination file for writing.
out, err := os.Create(dst)
Expand Down
2 changes: 1 addition & 1 deletion pkg/compute/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (c *Client) UpdatePackage(serviceID string, v int, path string) error {
if err != nil {
return fmt.Errorf("error reading package: %w", err)
}
defer file.Close()
defer file.Close() // #nosec G307

var body bytes.Buffer
w := multipart.NewWriter(&body)
Expand Down
2 changes: 1 addition & 1 deletion pkg/compute/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func validate(path string) error {
if err != nil {
return fmt.Errorf("error reading package: %w", err)
}
defer file.Close()
defer file.Close() // #nosec G307

tar := archiver.NewTarGz()
err = tar.Open(file, 0)
Expand Down

0 comments on commit 02a073d

Please sign in to comment.