forked from TrueCloudLab/distribution
reference, registry: fix loop variable captured by func literal (govet)
reference/normalize_test.go:274:40: loopclosure: loop variable r captured by func literal (govet) named, err := ParseNormalizedNamed(r) ^ reference/normalize_test.go:276:29: loopclosure: loop variable r captured by func literal (govet) t.Fatalf("ref=%s: %v", r, err) ^ registry/api/errcode/errors_test.go:45:7: loopclosure: loop variable ec captured by func literal (govet) if ec != desc.Code { ^ registry/api/errcode/errors_test.go:46:66: loopclosure: loop variable ec captured by func literal (govet) t.Fatalf("error code in descriptor isn't correct, %q != %q", ec, desc.Code) ^ registry/api/errcode/errors_test.go:49:23: loopclosure: loop variable desc captured by func literal (govet) if idToDescriptors[desc.Value].Code != ec { ^ registry/api/errcode/errors_test.go:50:80: loopclosure: loop variable desc captured by func literal (govet) t.Fatalf("error code in idToDesc isn't correct, %q != %q", idToDescriptors[desc.Value].Code, ec) ^ registry/api/errcode/errors_test.go:53:7: loopclosure: loop variable ec captured by func literal (govet) if ec.Message() != desc.Message { ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
c9b844e533
commit
4052d269f5
2 changed files with 4 additions and 1 deletions
|
@ -269,6 +269,7 @@ func TestParseRepositoryInfo(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, r := range refStrings {
|
for _, r := range refStrings {
|
||||||
|
r := r
|
||||||
t.Run(strconv.Itoa(i)+"/"+r, func(t *testing.T) {
|
t.Run(strconv.Itoa(i)+"/"+r, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
named, err := ParseNormalizedNamed(r)
|
named, err := ParseNormalizedNamed(r)
|
||||||
|
|
|
@ -39,9 +39,11 @@ func TestErrorCodes(t *testing.T) {
|
||||||
t.Fatal("errors aren't loaded!")
|
t.Fatal("errors aren't loaded!")
|
||||||
}
|
}
|
||||||
|
|
||||||
for ec, desc := range errorCodeToDescriptors {
|
for ec := range errorCodeToDescriptors {
|
||||||
|
ec := ec
|
||||||
t.Run(ec.String(), func(t *testing.T) {
|
t.Run(ec.String(), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
desc := errorCodeToDescriptors[ec]
|
||||||
if ec != desc.Code {
|
if ec != desc.Code {
|
||||||
t.Fatalf("error code in descriptor isn't correct, %q != %q", ec, desc.Code)
|
t.Fatalf("error code in descriptor isn't correct, %q != %q", ec, desc.Code)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue