Skip to content

Commit

Permalink
Merge pull request #396 from ackama:linter/enable-contextcheck
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 716623523
  • Loading branch information
copybara-github committed Jan 17, 2025
2 parents 8e16dd8 + 4da7a12 commit e6fdbeb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ linters:
- bodyclose
- canonicalheader
# - containedctx
# - contextcheck
- contextcheck
- copyloopvar
- decorder
# - depguard
Expand Down
6 changes: 3 additions & 3 deletions extractor/filesystem/os/rpm/rpm_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (e Extractor) extractFromInput(ctx context.Context, input *filesystem.ScanI
}
}()
}
rpmPkgs, err := e.parseRPMDB(absPath)
rpmPkgs, err := e.parseRPMDB(ctx, absPath)
if err != nil {
return nil, fmt.Errorf("ParseRPMDB(%s): %w", absPath, err)
}
Expand Down Expand Up @@ -213,7 +213,7 @@ func (e Extractor) extractFromInput(ctx context.Context, input *filesystem.ScanI
}

// parseRPMDB returns a slice of OS packages parsed from a RPM DB.
func (e Extractor) parseRPMDB(path string) ([]rpmPackageInfo, error) {
func (e Extractor) parseRPMDB(ctx context.Context, path string) ([]rpmPackageInfo, error) {
db, err := rpmdb.Open(path)
if err != nil {
return nil, err
Expand All @@ -227,7 +227,7 @@ func (e Extractor) parseRPMDB(path string) ([]rpmPackageInfo, error) {
return nil, err
}
} else {
ctx, cancelFunc := context.WithTimeout(context.Background(), e.Timeout)
ctx, cancelFunc := context.WithTimeout(ctx, e.Timeout)
defer cancelFunc()

// The timeout is only for corrupt bdb databases
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func containersFromAPI(ctx context.Context, client CtrdClient) ([]Metadata, erro

func namespacesFromAPI(ctx context.Context, client CtrdClient) ([]string, error) {
nsService := client.NamespaceService()
nss, err := nsService.List(context.Background())
nss, err := nsService.List(ctx)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit e6fdbeb

Please sign in to comment.