Skip to content

Commit

Permalink
lovely lint
Browse files Browse the repository at this point in the history
  • Loading branch information
cesartw committed Aug 22, 2024
1 parent a1e6b93 commit d24994f
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions aesutil/aesutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ func TestInvalidKeysAndData(t *testing.T) {
data := []byte(testPlaintext)
_, err := Encrypt("", data)
if err == nil {
t.Errorf("Encrypt succeeded with an empty key")
t.Error("Encrypt succeeded with an empty key")
}

// Decrypt with empty key
_, err = Decrypt("", testCiphertext)
if err == nil {
t.Errorf("Decrypt succeeded with an empty key")
t.Error("Decrypt succeeded with an empty key")
}

// Decrypt with an incorrect key
Expand All @@ -48,13 +48,13 @@ func TestInvalidKeysAndData(t *testing.T) {
// Decrypt an short string (i.e. smaller than block size)
_, err = Decrypt(testKeyString, "aaaabbbbcccc")
if err == nil {
t.Errorf("Decrypt succeeded with an invalid key size")
t.Error("Decrypt succeeded with an invalid key size")
}

// Decrypt a non-base64 string
_, err = Decrypt(testKeyString, fmt.Sprintf("%s#@?`", testCiphertext))
if err == nil {
t.Errorf("Decrypt succeeded with an invalid base64 string")
t.Error("Decrypt succeeded with an invalid base64 string")
}
}

Expand Down Expand Up @@ -87,7 +87,7 @@ func TestEncryptAndDecrypt(t *testing.T) {
t.Fatal("Decrypt failed, plaintext result is nil")
}
if string(plain) != testData {
t.Fatalf(diff.Cmp(testData, string(plain)))
t.Fatal(diff.Cmp(testData, string(plain)))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion goutil/goutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func ResolveWildcard(path string, mode build.ImportMode) ([]*build.Package, erro

// Gather a list of directories with *.go files.
goDirs := make(map[string]struct{})
err = filepath.Walk(root.Dir, func(path string, info os.FileInfo, err error) error {
err = filepath.Walk(root.Dir, func(path string, info os.FileInfo, _ error) error {
if !strings.HasSuffix(path, ".go") || info.IsDir() || strings.Contains(path, "/vendor/") {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion ioutilx/copy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ func TestCopyTree(t *testing.T) {

err := CopyTree("test", "test_copytree", &CopyTreeOptions{
Symlinks: false,
Ignore: func(path string, fi []os.FileInfo) []string {
Ignore: func(_ string, _ []os.FileInfo) []string {
return []string{"fifo"}
},
CopyFunction: Copy,
Expand Down
2 changes: 1 addition & 1 deletion jsonutil/jsonutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestMustUnmarshal(t *testing.T) {
defer func() {
rec := recover()
if rec == nil {
t.Errorf("no panic?")
t.Error("no panic?")
}
}()

Expand Down
2 changes: 1 addition & 1 deletion maputil/maputil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestSwap(t *testing.T) {
t.Run(fmt.Sprintf("test-%v", i), func(t *testing.T) {
got := Swap(tc.in)
if !reflect.DeepEqual(got, tc.expected) {
t.Errorf(diff.Cmp(tc.expected, got))
t.Error(diff.Cmp(tc.expected, got))
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions ptrutil/ptr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestDereference_Int(t *testing.T) {
for i, test := range tests {
t.Run(fmt.Sprintf("test-%d", i), func(t *testing.T) {
if got := Dereference(test.ptr); got != test.expected {
t.Errorf(diff.Cmp(test.expected, got))
t.Error(diff.Cmp(test.expected, got))
}
})
}
Expand All @@ -47,7 +47,7 @@ func TestDereference_String(t *testing.T) {
for i, test := range tests {
t.Run(fmt.Sprintf("test-%d", i), func(t *testing.T) {
if got := Dereference(test.ptr); got != test.expected {
t.Errorf(diff.Cmp(test.expected, got))
t.Error(diff.Cmp(test.expected, got))
}
})
}
Expand Down
24 changes: 12 additions & 12 deletions sliceutil/sliceutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestJoin(t *testing.T) {
t.Run(fmt.Sprintf("test-%v", i), func(t *testing.T) {
got := Join(tc.in)
if got != tc.expected {
t.Errorf(diff.Cmp(tc.expected, got))
t.Error(diff.Cmp(tc.expected, got))
}
})
}
Expand Down Expand Up @@ -77,7 +77,7 @@ func TestJoinWith(t *testing.T) {
t.Run(fmt.Sprintf("test-%v", i), func(t *testing.T) {
got := JoinWith(tc.in, tc.delim)
if got != tc.expected {
t.Errorf(diff.Cmp(tc.expected, got))
t.Error(diff.Cmp(tc.expected, got))
}
})
}
Expand Down Expand Up @@ -114,7 +114,7 @@ func TestUniq_Int64(t *testing.T) {
t.Run(fmt.Sprintf("test-%v", i), func(t *testing.T) {
got := Unique(tc.in)
if !reflect.DeepEqual(got, tc.expected) {
t.Errorf(diff.Cmp(tc.expected, got))
t.Error(diff.Cmp(tc.expected, got))
}
})
}
Expand All @@ -139,7 +139,7 @@ func TestUniq_String(t *testing.T) {
t.Run(fmt.Sprintf("test-%v", i), func(t *testing.T) {
got := Unique(tc.in)
if !stringslicesequal(got, tc.expected) {
t.Errorf(diff.Cmp(tc.expected, got))
t.Error(diff.Cmp(tc.expected, got))
}
})
}
Expand All @@ -165,7 +165,7 @@ func TestMergeUnique_Int64(t *testing.T) {
got := MergeUnique(tc.in)
if !int64slicesequal(got, tc.expected) {
t.Log("IN", tc.in)
t.Errorf(diff.Cmp(tc.expected, got))
t.Error(diff.Cmp(tc.expected, got))
}
})
}
Expand Down Expand Up @@ -274,11 +274,11 @@ func TestCSVtoInt64Slice(t *testing.T) {
}

if err != tc.expectedErr && err.Error() != tc.expectedErr.Error() {
t.Errorf(diff.Cmp(tc.expectedErr.Error(), err.Error()))
t.Error(diff.Cmp(tc.expectedErr.Error(), err.Error()))
}

if !reflect.DeepEqual(got, tc.expected) {
t.Errorf(diff.Cmp(tc.expected, got))
t.Error(diff.Cmp(tc.expected, got))
}
})
}
Expand All @@ -301,7 +301,7 @@ func TestItemInSlice_String(t *testing.T) {
t.Run(fmt.Sprintf("test-%v", i), func(t *testing.T) {
got := Contains(tc.list, tc.find)
if got != tc.expected {
t.Errorf(diff.Cmp(tc.expected, got))
t.Error(diff.Cmp(tc.expected, got))
}
})
}
Expand All @@ -326,7 +326,7 @@ func TestInFoldedStringSlice(t *testing.T) {
t.Run(fmt.Sprintf("test-%v", i), func(t *testing.T) {
got := InFoldedStringSlice(tc.list, tc.find)
if got != tc.expected {
t.Errorf(diff.Cmp(tc.expected, got))
t.Error(diff.Cmp(tc.expected, got))
}
})
}
Expand All @@ -349,7 +349,7 @@ func TestItemInSlice_Int(t *testing.T) {
t.Run(fmt.Sprintf("test-%v", i), func(t *testing.T) {
got := Contains(tc.list, tc.find)
if got != tc.expected {
t.Errorf(diff.Cmp(tc.expected, got))
t.Error(diff.Cmp(tc.expected, got))
}
})
}
Expand All @@ -372,7 +372,7 @@ func TestItemInSlice_Int64(t *testing.T) {
t.Run(fmt.Sprintf("test-%v", i), func(t *testing.T) {
got := Contains(tc.list, tc.find)
if got != tc.expected {
t.Errorf(diff.Cmp(tc.expected, got))
t.Error(diff.Cmp(tc.expected, got))
}
})
}
Expand Down Expand Up @@ -657,7 +657,7 @@ func TestValues(t *testing.T) {
return t.Name
})
if !reflect.DeepEqual(got, tc.expected) {
t.Errorf(diff.Cmp(tc.expected, got))
t.Error(diff.Cmp(tc.expected, got))
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions syncutil/syncmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestMap_Range(t *testing.T) {
m.Store(k, v)
}

m.Range(func(k string, v int) bool {
m.Range(func(k string, _ int) bool {
seen, ok := test[k]
if !ok {
t.Fatalf("unexpected key '%s'", k)
Expand Down Expand Up @@ -95,7 +95,7 @@ func TestMap_Range_EarlyReturn(t *testing.T) {

var count int

m.Range(func(k string, v int) bool {
m.Range(func(_ string, _ int) bool {
count++
return false
})
Expand Down

0 comments on commit d24994f

Please sign in to comment.