diff --git a/pkg/config/generator.go b/pkg/config/generator.go index 8954186..c81fdd6 100644 --- a/pkg/config/generator.go +++ b/pkg/config/generator.go @@ -3,8 +3,8 @@ package config import ( "bytes" "fmt" - "io/ioutil" "log" + "os" "path" "path/filepath" "strings" @@ -36,7 +36,7 @@ func (m *Generator) Load(paths []string) error { upstreamDefined := make(map[string]bool) for _, p := range paths { - files, err := ioutil.ReadDir(p) + files, err := os.ReadDir(p) if err != nil { return err } @@ -57,7 +57,7 @@ func (m *Generator) Load(paths []string) error { } repoProxies = append(repoProxies, rpmRepoProxies...) for _, upstream := range rpmUpstreams { - if _, ok := upstreamDefined[upstream.Name]; !ok { // Dedupe upstreams + if _, ok := upstreamDefined[upstream.Name]; !ok { // Dedupe upstreams upstreamDefined[upstream.Name] = true upstreams = append(upstreams, upstream) } @@ -76,7 +76,7 @@ func (m *Generator) Load(paths []string) error { if len(m.configPath) == 0 { log.Printf("template:\n%s", buf.String()) } else { - if err := ioutil.WriteFile(m.configPath, buf.Bytes(), 0640); err != nil { + if err := os.WriteFile(m.configPath, buf.Bytes(), 0640); err != nil { return err } } diff --git a/pkg/config/rpm.go b/pkg/config/rpm.go index 29b9d77..77affb5 100644 --- a/pkg/config/rpm.go +++ b/pkg/config/rpm.go @@ -3,10 +3,10 @@ package config import ( b64 "encoding/base64" "fmt" - "io/ioutil" "log" "net" "net/url" + "os" "strings" "github.com/go-ini/ini" @@ -35,14 +35,14 @@ func getUsernamePassword(section *ini.Section) (string, error) { return "", fmt.Errorf("%s and %s must both be specified", usernameFileKey, passwordFileKey) } // Load username from file and remove nonstandard key - usernameIn, err := ioutil.ReadFile(section.Key(usernameFileKey).Value()) + usernameIn, err := os.ReadFile(section.Key(usernameFileKey).Value()) if err != nil { return "", fmt.Errorf("unable to read %s: %v", usernameFileKey, err) } section.DeleteKey(usernameFileKey) // Load password from file and remove nonstandard key - passwordIn, err := ioutil.ReadFile(section.Key(passwordFileKey).Value()) + passwordIn, err := os.ReadFile(section.Key(passwordFileKey).Value()) if err != nil { return "", fmt.Errorf("unable to read %s: %v", passwordFileKey, err) } @@ -123,9 +123,9 @@ func LoadRPMRepoUpstreams(iniFile string) ([]Upstream, []RepoProxy, error) { } upstream := Upstream{ - Repo: true, - Name: proxyPassURL.Host, - Hosts: hosts, + Repo: true, + Name: proxyPassURL.Host, + Hosts: hosts, } repoProxy := RepoProxy{