forked from loafle/openapi-generator-original
[go-server] Fix: error handling and linting (#18550)
* Update error.go and fix lint * Regen * Fix incorrect change * Fix handler issue * Regenerate
This commit is contained in:
@@ -35,7 +35,7 @@ func WithUserAPIErrorHandler(h ErrorHandler) UserAPIOption {
|
||||
}
|
||||
|
||||
// NewUserAPIController creates a default api controller
|
||||
func NewUserAPIController(s UserAPIServicer, opts ...UserAPIOption) Router {
|
||||
func NewUserAPIController(s UserAPIServicer, opts ...UserAPIOption) *UserAPIController {
|
||||
controller := &UserAPIController{
|
||||
service: s,
|
||||
errorHandler: DefaultErrorHandler,
|
||||
@@ -118,7 +118,7 @@ func (c *UserAPIController) CreateUser(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
// If no error, encode the body and the result code
|
||||
EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
_ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
}
|
||||
|
||||
// CreateUsersWithArrayInput - Creates list of users with given input array
|
||||
@@ -143,7 +143,7 @@ func (c *UserAPIController) CreateUsersWithArrayInput(w http.ResponseWriter, r *
|
||||
return
|
||||
}
|
||||
// If no error, encode the body and the result code
|
||||
EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
_ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
}
|
||||
|
||||
// CreateUsersWithListInput - Creates list of users with given input array
|
||||
@@ -168,7 +168,7 @@ func (c *UserAPIController) CreateUsersWithListInput(w http.ResponseWriter, r *h
|
||||
return
|
||||
}
|
||||
// If no error, encode the body and the result code
|
||||
EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
_ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
}
|
||||
|
||||
// DeleteUser - Delete user
|
||||
@@ -205,7 +205,7 @@ func (c *UserAPIController) DeleteUser(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
// If no error, encode the body and the result code
|
||||
EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
_ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
}
|
||||
|
||||
// GetUserByName - Get user by user name
|
||||
@@ -223,7 +223,7 @@ func (c *UserAPIController) GetUserByName(w http.ResponseWriter, r *http.Request
|
||||
return
|
||||
}
|
||||
// If no error, encode the body and the result code
|
||||
EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
_ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
}
|
||||
|
||||
// LoginUser - Logs user into the system
|
||||
@@ -272,7 +272,7 @@ func (c *UserAPIController) LoginUser(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
// If no error, encode the body and the result code
|
||||
EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
_ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
}
|
||||
|
||||
// LogoutUser - Logs out current logged in user session
|
||||
@@ -284,7 +284,7 @@ func (c *UserAPIController) LogoutUser(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
// If no error, encode the body and the result code
|
||||
EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
_ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
}
|
||||
|
||||
// UpdateUser - Updated user
|
||||
@@ -317,5 +317,5 @@ func (c *UserAPIController) UpdateUser(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
// If no error, encode the body and the result code
|
||||
EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
_ = EncodeJSONResponse(result.Body, &result.Code, result.Headers, w)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user