aboutsummaryrefslogtreecommitdiffstats
path: root/modules/context/api.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-01-20 18:46:10 +0100
committerGitHub <noreply@github.com>2022-01-20 18:46:10 +0100
commit54e9ee37a7a301dbe74d46fd3c87712e6120e9bf (patch)
tree1be12fb072625c1b896b9d72f7912b018aad502b /modules/context/api.go
parent1d98d205f5825f40110e6628b61a97c91ac7f72d (diff)
downloadgitea-54e9ee37a7a301dbe74d46fd3c87712e6120e9bf.tar.gz
gitea-54e9ee37a7a301dbe74d46fd3c87712e6120e9bf.zip
format with gofumpt (#18184)
* gofumpt -w -l . * gofumpt -w -l -extra . * Add linter * manual fix * change make fmt
Diffstat (limited to 'modules/context/api.go')
-rw-r--r--modules/context/api.go21
1 files changed, 10 insertions, 11 deletions
diff --git a/modules/context/api.go b/modules/context/api.go
index dae6d23989..c825e48753 100644
--- a/modules/context/api.go
+++ b/modules/context/api.go
@@ -56,29 +56,29 @@ type APIInvalidTopicsError struct {
InvalidTopics []string `json:"invalidTopics"`
}
-//APIEmpty is an empty response
+// APIEmpty is an empty response
// swagger:response empty
type APIEmpty struct{}
-//APIForbiddenError is a forbidden error response
+// APIForbiddenError is a forbidden error response
// swagger:response forbidden
type APIForbiddenError struct {
APIError
}
-//APINotFound is a not found empty response
+// APINotFound is a not found empty response
// swagger:response notFound
type APINotFound struct{}
-//APIConflict is a conflict empty response
+// APIConflict is a conflict empty response
// swagger:response conflict
type APIConflict struct{}
-//APIRedirect is a redirect response
+// APIRedirect is a redirect response
// swagger:response redirect
type APIRedirect struct{}
-//APIString is a string response
+// APIString is a string response
// swagger:response string
type APIString string
@@ -269,13 +269,12 @@ func APIAuth(authMethod auth_service.Method) func(*APIContext) {
// APIContexter returns apicontext as middleware
func APIContexter() func(http.Handler) http.Handler {
- var csrfOpts = getCsrfOpts()
+ csrfOpts := getCsrfOpts()
return func(next http.Handler) http.Handler {
-
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- var locale = middleware.Locale(w, req)
- var ctx = APIContext{
+ locale := middleware.Locale(w, req)
+ ctx := APIContext{
Context: &Context{
Resp: NewResponse(w),
Data: map[string]interface{}{},
@@ -354,7 +353,7 @@ func ReferencesGitRepo(allowEmpty bool) func(ctx *APIContext) (cancel context.Ca
// NotFound handles 404s for APIContext
// String will replace message, errors will be added to a slice
func (ctx *APIContext) NotFound(objs ...interface{}) {
- var message = ctx.Tr("error.not_found")
+ message := ctx.Tr("error.not_found")
var errors []string
for _, obj := range objs {
// Ignore nil