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
675675 // getErrorResponse gets in standard error and resource value and
676676 // provides a encodable populated response values
677677 func getAPIErrorResponse(err APIError, resource string) APIErrorResponse {
678− var data = APIErrorResponse{}
679− data.Code = err.Code
680− data.Message = err.Description
681− if resource != "" {
682− data.Resource = resource
678+ return APIErrorResponse{
679+ Code: err.Code,
680+ Message: err.Description,
681+ Resource: resource,
682+ RequestID: "3L137",
683+ HostID: "3L137",
683684 }
684− // TODO implement this in future
685− data.RequestID = "3L137"
686− data.HostID = "3L137"
687−
688− return data
689685 }

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