From e259ca209c3548f01050db7c71feee919dd319c9 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Tue, 6 Sep 2022 00:35:20 +0200 Subject: [PATCH] Lint: Fix broken / missing nosec / nolint comments Signed-off-by: Knut Ahlers --- internal/template/random/random.go | 6 +++--- main.go | 2 +- twitch/twitch.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/template/random/random.go b/internal/template/random/random.go index c157b39..8c92d0a 100644 --- a/internal/template/random/random.go +++ b/internal/template/random/random.go @@ -22,7 +22,7 @@ func randomString(lst ...string) (string, error) { return "", errors.New("empty list given") } - return lst[rand.Intn(len(lst))], nil + return lst[rand.Intn(len(lst))], nil // #nosec:G404 // This is used to select a random string from a list, no crypto-use } func stableRandomFromSeed(seed string) (float64, error) { @@ -31,11 +31,11 @@ func stableRandomFromSeed(seed string) (float64, error) { return 0, errors.Wrap(err, "generating seed") } - return rand.New(rand.NewSource(seedValue)).Float64(), nil // #nosec G404 // Only used for generating a random number from static string, no need for cryptographic safety + return rand.New(rand.NewSource(seedValue)).Float64(), nil // #nosec:G404 // Only used for generating a random number from static string, no need for cryptographic safety } func stringToSeed(s string) (int64, error) { - hash := md5.New() // #nosec G401 // Unly used to convert a string into a numer, no need for cryptographic safety + hash := md5.New() // #nosec:G401 // Unly used to convert a string into a numer, no need for cryptographic safety if _, err := fmt.Fprint(hash, s); err != nil { return 0, errors.Wrap(err, "writing string to hasher") } diff --git a/main.go b/main.go index ba32c6b..77e3d2e 100644 --- a/main.go +++ b/main.go @@ -151,7 +151,7 @@ func handleSubCommand(args []string) { } } -//nolint: funlen,gocognit,gocyclo // Complexity is a little too high but makes no sense to split +//nolint:funlen,gocognit,gocyclo // Complexity is a little too high but makes no sense to split func main() { var err error diff --git a/twitch/twitch.go b/twitch/twitch.go index 05a5352..4101424 100644 --- a/twitch/twitch.go +++ b/twitch/twitch.go @@ -739,7 +739,7 @@ func (c *Client) getTwitchAppAccessToken() (string, error) { return rData.AccessToken, nil } -//nolint: gocognit,gocyclo // Not gonna split to keep as a logical unit +//nolint:gocognit,gocyclo // Not gonna split to keep as a logical unit func (c *Client) request(opts clientRequestOpts) error { log.WithFields(log.Fields{ "method": opts.Method,