diff --git a/api/errors/descriptors.go b/api/errors/descriptors.go index 1d71162f3..d2f0f7da9 100644 --- a/api/errors/descriptors.go +++ b/api/errors/descriptors.go @@ -26,9 +26,9 @@ type ErrorDescriptor struct { HTTPStatusCodes []int } -// Descriptors provides a list of HTTP API Error codes that may be encountered -// when interacting with the registry API. -var Descriptors = []ErrorDescriptor{ +// ErrorDescriptors provides a list of HTTP API Error codes that may be +// encountered when interacting with the registry API. +var ErrorDescriptors = []ErrorDescriptor{ { Code: ErrorCodeUnknown, Value: "UNKNOWN", @@ -131,10 +131,10 @@ var errorCodeToDescriptors map[ErrorCode]ErrorDescriptor var idToDescriptors map[string]ErrorDescriptor func init() { - errorCodeToDescriptors = make(map[ErrorCode]ErrorDescriptor, len(Descriptors)) - idToDescriptors = make(map[string]ErrorDescriptor, len(Descriptors)) + errorCodeToDescriptors = make(map[ErrorCode]ErrorDescriptor, len(ErrorDescriptors)) + idToDescriptors = make(map[string]ErrorDescriptor, len(ErrorDescriptors)) - for _, descriptor := range Descriptors { + for _, descriptor := range ErrorDescriptors { errorCodeToDescriptors[descriptor.Code] = descriptor idToDescriptors[descriptor.Value] = descriptor } diff --git a/api/errors/errors_test.go b/api/errors/errors_test.go index 7a68fe905..2f5c69e04 100644 --- a/api/errors/errors_test.go +++ b/api/errors/errors_test.go @@ -11,7 +11,7 @@ import ( // TestErrorCodes ensures that error code format, mappings and // marshaling/unmarshaling. round trips are stable. func TestErrorCodes(t *testing.T) { - for _, desc := range Descriptors { + for _, desc := range ErrorDescriptors { if desc.Code.String() != desc.Value { t.Fatalf("error code string incorrect: %q != %q", desc.Code.String(), desc.Value) } diff --git a/cmd/registry-api-doctable-gen/main.go b/cmd/registry-api-doctable-gen/main.go index f76c249ed..869f1a374 100644 --- a/cmd/registry-api-doctable-gen/main.go +++ b/cmd/registry-api-doctable-gen/main.go @@ -61,7 +61,7 @@ func dumpErrors(wr io.Writer) { fmt.Fprintln(writer, "\n"+divider) - for _, descriptor := range errors.Descriptors { + for _, descriptor := range errors.ErrorDescriptors { fmt.Fprint(writer, "|") v := reflect.ValueOf(descriptor)