History

Add constants for commonly used values. (#3588)

This is a consolidation effort, avoiding usage of naked strings in codebase. Whenever possible use constants which can be repurposed elsewhere. This also fixes `goconst ./...` reported issues.

Harshavardhana committed 9 years ago

Commit 62f83431 parent f803bb479 files · +461 −462Browse files

Showing the changes to cmd/api-errors.go (1 of 79 files). Show all

Unified · Split

cmd/api-errors.go+6−10
@@ -675,15 +675,11 @@ func getAPIError(code APIErrorCode) APIError { · 674 unmodified lines
675// getErrorResponse gets in standard error and resource value and675// getErrorResponse gets in standard error and resource value and
676// provides a encodable populated response values676// provides a encodable populated response values
677func getAPIErrorResponse(err APIError, resource string) APIErrorResponse {677func getAPIErrorResponse(err APIError, resource string) APIErrorResponse {
678 var data = APIErrorResponse{}678 return APIErrorResponse{
679 data.Code = err.Code679 Code: err.Code,
680 data.Message = err.Description680 Message: err.Description,
681 if resource != "" {681 Resource: resource,
682 data.Resource = resource682 RequestID: "3L137",
683 HostID: "3L137",
683 }684 }
684 // TODO implement this in future
685 data.RequestID = "3L137"
686 data.HostID = "3L137"
687
688 return data
689}685}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t