Skip to content

Commit

Permalink
fix lints
Browse files Browse the repository at this point in the history
Signed-off-by: cpanato <[email protected]>
  • Loading branch information
cpanato committed Aug 31, 2022
1 parent ead3816 commit 31edcce
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

linters:
enable:
- deadcode
- unused
- errcheck
- gofmt
- goimports
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions federation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package main

import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"

"github.com/sigstore/fulcio/pkg/config"
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
}
5 changes: 2 additions & 3 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/config_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package config

import (
"context"
"io/ioutil"
"os"
"path/filepath"
"testing"

Expand All @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/server/max_bytes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package server

import (
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"strings"
Expand All @@ -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
Expand Down

0 comments on commit 31edcce

Please sign in to comment.