diff --git a/cmd/tkn/main.go b/cmd/tkn/main.go index 29b5bee5be..021f5cf185 100644 --- a/cmd/tkn/main.go +++ b/cmd/tkn/main.go @@ -39,6 +39,7 @@ func main() { } // if we have found the plugin then sysexec it by replacing current process. + // #nosec G702 -- exCmd is from our plugin discovery path, not user input if err := syscall.Exec(exCmd, append([]string{exCmd}, os.Args[2:]...), os.Environ()); err != nil { fmt.Fprintf(os.Stderr, "Command finished with error: %v", err) os.Exit(127) diff --git a/pkg/formatted/color.go b/pkg/formatted/color.go index 331058079c..d4e8cbcd0b 100644 --- a/pkg/formatted/color.go +++ b/pkg/formatted/color.go @@ -115,6 +115,8 @@ type atomicCounter struct { func (c *atomicCounter) next() int { v := atomic.AddUint32(&c.value, 1) next := int(v-1) % c.threshold + // nolint + // this conversion is throwing error for golangci-lint G115 atomic.CompareAndSwapUint32(&c.value, uint32(c.threshold), 0) return next diff --git a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go index e0d41b4801..a2154f786a 100644 --- a/pkg/plugins/plugins.go +++ b/pkg/plugins/plugins.go @@ -71,6 +71,7 @@ func GetAllTknPluginFromPaths() []string { continue } fpath := filepath.Join(path, file.Name()) + // #nosec G703 -- fpath is from filepath.Join with validated path info, err := os.Stat(fpath) if err != nil { continue diff --git a/pkg/suggestion/suggest.go b/pkg/suggestion/suggest.go index 136fc5c9e2..97d5989b7c 100644 --- a/pkg/suggestion/suggest.go +++ b/pkg/suggestion/suggest.go @@ -113,14 +113,14 @@ func levenshteinDistance(s, t string, ignoreCase bool) int { if s[i-1] == t[j-1] { d[i][j] = d[i-1][j-1] } else { - min := d[i-1][j] - if d[i][j-1] < min { - min = d[i][j-1] + minCost := d[i-1][j] + if d[i][j-1] < minCost { + minCost = d[i][j-1] } - if d[i-1][j-1] < min { - min = d[i-1][j-1] + if d[i-1][j-1] < minCost { + minCost = d[i-1][j-1] } - d[i][j] = min + 1 + d[i][j] = minCost + 1 } }