Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ issues:
- dupl
- gosec
- goconst
exclude:
- "G302: Expect file permissions to be 0600 or less"
- "G304: Potential file inclusion via variable"
- "G204: Subprocess launched with a potential tainted input or cmd arguments"
linters:
enable:
- gosec
Expand Down
4 changes: 1 addition & 3 deletions cmd/benchdiff/internal/benchdiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ stderr: %s`, cmd.String(), exitErr.ExitCode(), bufStderr.String())
}

func (c *Benchdiff) runBenchmark(ref, filename, extraArgs string, pause time.Duration, force bool) (errOut error) {
cmd := exec.Command(c.BenchCmd, strings.Fields(c.BenchArgs+" "+extraArgs)...) //nolint:gosec // this is fine
cmd := exec.Command(c.BenchCmd, strings.Fields(c.BenchArgs+" "+extraArgs)...)

stdlib := false
if rootPath, err := runGitCmd(c.debug(), c.gitCmd(), c.Path, "rev-parse", "--show-toplevel"); err == nil {
Expand All @@ -123,7 +123,6 @@ func (c *Benchdiff) runBenchmark(ref, filename, extraArgs string, pause time.Dur
return nil
}
}
//nolint:gosec // user provides filename
file, err := os.Create(filename)
if err != nil {
return err
Expand All @@ -146,7 +145,6 @@ func (c *Benchdiff) runBenchmark(ref, filename, extraArgs string, pause time.Dur
time.Sleep(pause)
}
if stdlib {
//nolint:gosec // workPath is a temp dir
makeCmd := exec.Command(filepath.Join(workPath, "src", "make.bash"))
makeCmd.Dir = filepath.Join(workPath, "src")
runErr = runCmd(makeCmd, c.debug())
Expand Down
2 changes: 1 addition & 1 deletion cmd/benchdiff/internal/gitrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func runGitCmd(debug *log.Logger, gitCmd, repoPath string, args ...string) ([]byte, error) {
var stdout bytes.Buffer
cmd := exec.Command(gitCmd, args...) //nolint:gosec // this is fine
cmd := exec.Command(gitCmd, args...)
cmd.Stdout = &stdout
cmd.Dir = repoPath
err := runCmd(cmd, debug)
Expand Down
2 changes: 1 addition & 1 deletion pkg/benchstatter/benchstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (b *Benchstat) OutputTables(writer io.Writer, tables []*benchstat.Table) er
// AddCollectionFiles adds files to a collection
func AddCollectionFiles(c *benchstat.Collection, files ...string) error {
for _, file := range files {
f, err := os.Open(file) //nolint:gosec // this is fine
f, err := os.Open(file)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/benchstatter/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func writeGroupMarkdown(w io.Writer, tables []*benchstat.Table, groupIdx int, gr
}

// MarkdownFormatter return a markdown OutputFormatter
func MarkdownFormatter(opts *MarkdownFormatterOptions) OutputFormatter { //nolint:gocyclo // punt this to later
func MarkdownFormatter(opts *MarkdownFormatterOptions) OutputFormatter {
return func(w io.Writer, tables []*benchstat.Table) error {
return FormatMarkdown(w, tables, opts)
}
Expand Down