Fix various golangci-lint errors (#2059)

This commit is contained in:
Anton Bretting
2022-02-12 20:28:08 +09:00
committed by GitHub
parent 9a2df3c0a2
commit 2f04831817
29 changed files with 362 additions and 263 deletions
+9 -7
View File
@@ -3,10 +3,11 @@ package tmpl
import (
"encoding/json"
"fmt"
"github.com/google/go-cmp/cmp"
"path/filepath"
"reflect"
"testing"
"github.com/google/go-cmp/cmp"
)
func TestReadFile(t *testing.T) {
@@ -207,14 +208,15 @@ func TestRequired(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := Required(tt.args.warn, tt.args.val)
if (err != nil) != tt.wantErr {
t.Errorf("Required() error = %v, wantErr %v", err, tt.wantErr)
testCase := tt
t.Run(testCase.name, func(t *testing.T) {
got, err := Required(testCase.args.warn, testCase.args.val)
if (err != nil) != testCase.wantErr {
t.Errorf("Required() error = %v, wantErr %v", err, testCase.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("Required() got = %v, want %v", got, tt.want)
if !reflect.DeepEqual(got, testCase.want) {
t.Errorf("Required() got = %v, want %v", got, testCase.want)
}
})
}