Skip to content

Commit

Permalink
*: fix gosimple warnings
Browse files Browse the repository at this point in the history
Fixes part of coreos#1121
  • Loading branch information
sohankunkerkar committed Dec 7, 2020
1 parent e3b3888 commit 548c250
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
12 changes: 6 additions & 6 deletions config/validate/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,29 +128,29 @@ func TestValidateWithContext(t *testing.T) {
},
{
in: test3{
NoDups: make([]testDup, 1, 1),
NoDups: make([]testDup, 1),
},
},
{
in: test3{
NoDups: make([]testDup, 2, 2),
NoDups: make([]testDup, 2),
},
out: mkReport(ignerrors.ErrDuplicate, path.New("json", "dups", 1), report.Error, 0, 0),
},
{
in: test4{
Ignored: make([]testDup, 2, 2),
Ignored: make([]testDup, 2),
},
},
{
in: test5{
NoDups1: make([]testDup, 1, 1),
NoDups1: make([]testDup, 1),
},
},
{
in: test5{
NoDups1: make([]testDup, 1, 1),
NoDups2: make([]testDup, 1, 1),
NoDups1: make([]testDup, 1),
NoDups2: make([]testDup, 1),
},
out: mkReport(ignerrors.ErrDuplicate, path.New("json", "dups2", 0), report.Error, 0, 0),
},
Expand Down
4 changes: 2 additions & 2 deletions internal/exec/stages/disks/partitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ func parseSgdiskPretend(sgdiskOut string, partitionNumbers []int) (map[int]sgdis
if len(partitionNumbers) == 0 {
return nil, nil
}
startRegex := regexp.MustCompile("^First sector: (\\d*) \\(.*\\)$")
endRegex := regexp.MustCompile("^Last sector: (\\d*) \\(.*\\)$")
startRegex := regexp.MustCompile(`^First sector: (\d*) \(.*\)$`)
endRegex := regexp.MustCompile(`^Last sector: (\d*) \(.*\)$`)
const (
START = iota
END = iota
Expand Down
1 change: 0 additions & 1 deletion tests/negative/proxy/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
var (
proxyServer = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Proxy is unavailable", http.StatusServiceUnavailable)
return
}))

mockConfigURL = "http://www.fake.tld"
Expand Down
4 changes: 2 additions & 2 deletions tests/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (disk *Disk) replaceAllUUIDVarsInPartitions(UUIDmap map[string]string) erro
func replaceUUIDVars(str string, UUIDmap map[string]string) (string, error) {
finalStr := str

pattern := regexp.MustCompile("\\$uuid([0-9]+)")
pattern := regexp.MustCompile(`\$uuid([0-9]+)`)
for _, match := range pattern.FindAllStringSubmatch(str, -1) {
if len(match) != 2 {
return str, fmt.Errorf("find all string submatch error: want length of 2, got length of %d", len(match))
Expand All @@ -269,7 +269,7 @@ func getUUID(key string, UUIDmap map[string]string) string {
// ReplaceAllVersionVars replaces Version variable (format $version) in configs with ConfigMinVersion
// Updates the old config version (oldVersion) with a new one (newVersion)
func (t *Test) ReplaceAllVersionVars(version string) {
pattern := regexp.MustCompile("\\$version")
pattern := regexp.MustCompile(`\$version`)
t.Config = pattern.ReplaceAllString(t.Config, version)
t.Name += " " + version
}
Expand Down

0 comments on commit 548c250

Please sign in to comment.