Skip to content

Commit

Permalink
Fix errors reported by golangci-lint
Browse files Browse the repository at this point in the history
main.go:291:17: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple)
main.go:22:2: SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)
  • Loading branch information
philpep committed Feb 1, 2024
1 parent 3c5a6e9 commit 19b730d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"os/user"
Expand Down Expand Up @@ -288,7 +287,7 @@ func (c *Config) getUpdates(configContainers []configAnnotationImageSpec, contai
reDigest := regexp.MustCompile(".*@(sha256:.*)")
// We construct a regex to obtain the image name without tag by removing the tag if present.
// A tag can contain lower case letters, upper case letters, digits, underscore, dot, and dash.
reImageName := regexp.MustCompile("(.*)(:[a-zA-Z0-9_\\.-]*)?")
reImageName := regexp.MustCompile(`(.*)(:[a-zA-Z0-9_\.-]*)?`)
update := make(map[string]string)
for _, container := range configContainers {
match := reDigest.FindStringSubmatch(container.Image)
Expand Down Expand Up @@ -554,7 +553,7 @@ func defaultKubeConfig() string {
}

func inClusterNamespace() string {
data, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
data, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 19b730d

Please sign in to comment.