Kaynağa Gözat

style: format code with Go fmt and Gofumpt

This commit fixes the style issues introduced in de467e5 according to the output
from Go fmt and Gofumpt.

Details: https://github.com/gogs/gogs/pull/8111
deepsource-autofix[bot] 2 hafta önce
ebeveyn
işleme
1bd867ab15
3 değiştirilmiş dosya ile 19 ekleme ve 19 silme
  1. 16 16
      internal/cmd/web.go
  2. 2 2
      internal/context/auth.go
  3. 1 1
      internal/context/context.go

+ 16 - 16
internal/cmd/web.go

@@ -147,7 +147,7 @@ func newFlamego() *flamego.Flame {
 	f.Use(captcha.Captchaer(captcha.Options{
 		URLPrefix: conf.Server.Subpath,
 	}))
-	
+
 	// Custom health check endpoint (replaces toolbox)
 	f.Get("/-/healthz", func(w http.ResponseWriter) {
 		if err := database.Ping(); err != nil {
@@ -158,7 +158,7 @@ func newFlamego() *flamego.Flame {
 		w.WriteHeader(http.StatusOK)
 		fmt.Fprint(w, "ok")
 	})
-	
+
 	return f
 }
 
@@ -172,23 +172,23 @@ func runWeb(c *cli.Context) error {
 
 	// Apply global middleware
 	f.Use(session.Sessioner(session.Options{
-		Provider: conf.Session.Provider,
-		Config:   conf.Session.ProviderConfig,
-		CookieName: conf.Session.CookieName,
-		CookiePath: conf.Server.Subpath,
-		Gclifetime: conf.Session.GCInterval,
+		Provider:    conf.Session.Provider,
+		Config:      conf.Session.ProviderConfig,
+		CookieName:  conf.Session.CookieName,
+		CookiePath:  conf.Server.Subpath,
+		Gclifetime:  conf.Session.GCInterval,
 		Maxlifetime: conf.Session.MaxLifeTime,
-		Secure: conf.Session.CookieSecure,
+		Secure:      conf.Session.CookieSecure,
 	}))
 	f.Use(csrf.Csrfer(csrf.Options{
-		Secret:     conf.Security.SecretKey,
-		Header:     "X-CSRF-Token",
-		Cookie:     conf.Session.CSRFCookieName,
-		Domain:     conf.Server.URL.Hostname(),
-		Path:       conf.Server.Subpath,
-		HTTPOnly:   true,
-		SetCookie:  true,
-		Secure:     conf.Server.URL.Scheme == "https",
+		Secret:    conf.Security.SecretKey,
+		Header:    "X-CSRF-Token",
+		Cookie:    conf.Session.CSRFCookieName,
+		Domain:    conf.Server.URL.Hostname(),
+		Path:      conf.Server.Subpath,
+		HTTPOnly:  true,
+		SetCookie: true,
+		Secure:    conf.Server.URL.Scheme == "https",
 	}))
 	f.Use(context.Contexter(context.NewStore()))
 

+ 2 - 2
internal/context/auth.go

@@ -143,7 +143,7 @@ func authenticatedUserID(store AuthStore, c flamego.Context, sess session.Sessio
 	if !database.HasEngine {
 		return 0, false
 	}
-	
+
 	req := c.Request()
 
 	// Check access token.
@@ -204,7 +204,7 @@ func authenticatedUser(store AuthStore, ctx flamego.Context, sess session.Sessio
 	}
 
 	uid, isTokenAuth := authenticatedUserID(store, ctx, sess)
-	
+
 	req := ctx.Request()
 
 	if uid <= 0 {

+ 1 - 1
internal/context/context.go

@@ -36,7 +36,7 @@ type Context struct {
 	ResponseWriter http.ResponseWriter
 	Request        *http.Request
 	Data           template.Data
-	
+
 	Link        string // Current request URL
 	User        *database.User
 	IsLogged    bool