Sebastiaan van Stijn
4052d269f5
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>
2023-05-09 16:04:08 +02:00
Sebastiaan van Stijn
f884a079df
registry/api/errorcode: TestErrorCodes: use sub-tests
...
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-05-09 13:55:11 +02:00
Sebastiaan van Stijn
e0281dc609
format code with gofumpt
...
gofumpt (https://github.com/mvdan/gofumpt ) provides a supserset of `gofmt` / `go fmt`,
and addresses various formatting issues that linters may be checking for.
We can consider enabling the `gofumpt` linter to verify the formatting in CI, although
not every developer may have it installed, so for now this runs it once to get formatting
in shape.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-03 22:48:20 +01:00
Stephen J Day
3f7f956f80
More consistent return from ErrorCode.Error()
...
To bring ErrorCode into liine with Go conventions, ErrorCode.Error() now
returns the "nice" value of the error code. This ensures error message assembly
works similar to commonly used Go conventions when directly using ErrorCode as
an error.
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2015-08-20 17:36:24 -07:00
Doug Davis
f5283cc5a2
Make Error.Error() return the post-arg-substitution Message
...
Missed this during the removal of the args property
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-07-22 12:44:59 -07:00
Doug Davis
94e2e9f4a0
Add ability to pass in substitution args into an Error
...
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-07-15 11:02:10 -07:00
Doug Davis
cb45ec56ff
Add back in the "errors" wrapper in the Errors serialization
...
See: https://github.com/docker/distribution/pull/548/files#r32794064
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-06-18 18:00:26 -07:00
Doug Davis
441f7cac87
Round 4
...
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-06-11 21:33:35 -07:00
Doug Davis
38393b63b7
Round 3 - Add Register function
...
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-06-02 10:01:21 -07:00
Doug Davis
0a6a6f5b81
Move ErrorCode logic to new errcode package
...
Make HTTP status codes match the ErrorCode by looking it up in the Descriptors
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-05-26 13:18:54 -07:00