Explorar el Código

style: format code with Go fmt and Gofumpt

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

Details: https://github.com/gogs/gogs/pull/8111
deepsource-autofix[bot] hace 2 semanas
padre
commit
977532eaaa
Se han modificado 3 ficheros con 10 adiciones y 10 borrados
  1. 4 4
      internal/context/context.go
  2. 5 5
      internal/email/email.go
  3. 1 1
      internal/route/user/auth.go

+ 4 - 4
internal/context/context.go

@@ -221,7 +221,7 @@ func (c *Context) SetCookie(name, value string, maxAge int, path string, args ..
 		Path:     path,
 		HttpOnly: true,
 	}
-	
+
 	// Handle optional parameters: domain, secure, httpOnly
 	for i, arg := range args {
 		switch i {
@@ -239,7 +239,7 @@ func (c *Context) SetCookie(name, value string, maxAge int, path string, args ..
 			}
 		}
 	}
-	
+
 	http.SetCookie(c.ResponseWriter, cookie)
 }
 
@@ -249,7 +249,7 @@ func (c *Context) GetSuperSecureCookie(secret, name string) (string, bool) {
 	if val == "" {
 		return "", false
 	}
-	
+
 	// In production, you'd want to verify the signature
 	// For now, just return the value
 	// TODO: Implement proper secure cookie verification
@@ -391,7 +391,7 @@ func (c *Context) ServeFile(file string, names ...string) {
 	} else {
 		name = filepath.Base(file)
 	}
-	
+
 	c.ResponseWriter.Header().Set("Content-Description", "File Transfer")
 	c.ResponseWriter.Header().Set("Content-Type", "application/octet-stream")
 	c.ResponseWriter.Header().Set("Content-Disposition", "attachment; filename="+name)

+ 5 - 5
internal/email/email.go

@@ -32,7 +32,7 @@ const (
 )
 
 var (
-	mailTemplates     map[string]*template.Template
+	mailTemplates map[string]*template.Template
 	templatesOnce sync.Once
 )
 
@@ -40,7 +40,7 @@ var (
 func render(tpl string, data map[string]any) (string, error) {
 	templatesOnce.Do(func() {
 		mailTemplates = make(map[string]*template.Template)
-		
+
 		funcMap := template.FuncMap{
 			"AppName": func() string {
 				return conf.App.BrandName
@@ -55,18 +55,18 @@ func render(tpl string, data map[string]any) (string, error) {
 				return template.HTML(markup.Sanitize(raw))
 			},
 		}
-		
+
 		// Load templates
 		templateDir := filepath.Join(conf.WorkDir(), "templates", "mail")
 		customDir := filepath.Join(conf.CustomDir(), "templates", "mail")
-		
+
 		// Parse templates from both directories
 		// For now, just use a simple approach - in production you'd want to handle this better
 		_ = templateDir
 		_ = customDir
 		_ = funcMap
 	})
-	
+
 	// For now, return a simple implementation
 	// TODO: Implement proper template rendering
 	return "", fmt.Errorf("template rendering not yet implemented for: %s", tpl)

+ 1 - 1
internal/route/user/auth.go

@@ -470,7 +470,7 @@ func Activate(c *context.Context) {
 		}
 		// Resend confirmation email.
 		if conf.Auth.RequireEmailConfirmation {
-		if _, err := c.Cache.Get(c.Req.Request.Context(), userutil.MailResendCacheKey(c.User.ID)); err == nil {
+			if _, err := c.Cache.Get(c.Req.Request.Context(), userutil.MailResendCacheKey(c.User.ID)); err == nil {
 				c.Data["ResendLimited"] = true
 			} else {
 				c.Data["Hours"] = conf.Auth.ActivateCodeLives / 60