diff --git a/.golangci.yml b/.golangci.yml index 2bf306d7a..2ddcd657b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -15,7 +15,7 @@ linters: enable: - - deadcode + - unused - errcheck - gofmt - goimports @@ -36,7 +36,7 @@ issues: linters: - staticcheck text: SA1019 - - path: pkg/ca/tinkca/signer.go + - path: pkg/ca/tinkca/signer.go linters: - staticcheck text: SA1019 diff --git a/federation/main.go b/federation/main.go index 2c89f91b8..b55053581 100644 --- a/federation/main.go +++ b/federation/main.go @@ -17,7 +17,7 @@ package main import ( "encoding/json" - "io/ioutil" + "os" "path/filepath" "github.com/sigstore/fulcio/pkg/config" @@ -79,7 +79,7 @@ func main() { }, } for _, m := range matches { - b, err := ioutil.ReadFile(m) + b, err := os.ReadFile(m) if err != nil { panic(err) } @@ -106,7 +106,7 @@ func main() { } // Update the yaml - yb, err := ioutil.ReadFile("config/fulcio-config.yaml") + yb, err := os.ReadFile("config/fulcio-config.yaml") if err != nil { panic(err) } @@ -125,7 +125,7 @@ func main() { yamlWithBoilerplate := boilerPlate + string(newYaml) - if err := ioutil.WriteFile("config/fulcio-config.yaml", []byte(yamlWithBoilerplate), 0600); err != nil { + if err := os.WriteFile("config/fulcio-config.yaml", []byte(yamlWithBoilerplate), 0600); err != nil { panic(err) } } diff --git a/pkg/config/config.go b/pkg/config/config.go index 67f2c0416..f0314c3fa 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -21,7 +21,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "net/http" "net/url" "os" @@ -371,7 +370,7 @@ func Load(configPath string) (*FulcioConfig, error) { } return config, nil } - b, err := ioutil.ReadFile(configPath) + b, err := os.ReadFile(configPath) if err != nil { return nil, fmt.Errorf("read file: %w", err) } @@ -398,7 +397,7 @@ func Read(b []byte) (*FulcioConfig, error) { rootCAs = x509.NewCertPool() } const k8sCA = "/var/run/fulcio/ca.crt" - certs, err := ioutil.ReadFile(k8sCA) + certs, err := os.ReadFile(k8sCA) if err != nil { return nil, fmt.Errorf("read file: %w", err) } diff --git a/pkg/config/config_network_test.go b/pkg/config/config_network_test.go index 002030d72..52808181a 100644 --- a/pkg/config/config_network_test.go +++ b/pkg/config/config_network_test.go @@ -19,7 +19,7 @@ package config import ( "context" - "io/ioutil" + "os" "path/filepath" "testing" @@ -30,7 +30,7 @@ import ( func TestLoad(t *testing.T) { td := t.TempDir() cfgPath := filepath.Join(td, "config.json") - if err := ioutil.WriteFile(cfgPath, []byte(validCfg), 0644); err != nil { + if err := os.WriteFile(cfgPath, []byte(validCfg), 0644); err != nil { t.Fatal(err) } diff --git a/pkg/server/max_bytes_test.go b/pkg/server/max_bytes_test.go index ffb0f2a4e..67a3a6076 100644 --- a/pkg/server/max_bytes_test.go +++ b/pkg/server/max_bytes_test.go @@ -16,7 +16,7 @@ package server import ( - "io/ioutil" + "io" "net/http" "net/http/httptest" "strings" @@ -26,7 +26,7 @@ import ( func TestWithMaxBytes(t *testing.T) { var maxBodySize int64 = 10 handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - _, err := ioutil.ReadAll(r.Body) + _, err := io.ReadAll(r.Body) if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) return