Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/config/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package config
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"os"
"path"
"path/filepath"
"strings"
Expand Down Expand Up @@ -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
}
Expand All @@ -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)
}
Expand All @@ -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
}
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/config/rpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package config
import (
b64 "encoding/base64"
"fmt"
"io/ioutil"
"log"
"net"
"net/url"
"os"
"strings"

"github.com/go-ini/ini"
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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{
Expand Down