Compare commits

..

1 Commits

Author SHA1 Message Date
GitCaddy
60ff19efc9 Fix linter issues: gofmt and modernize for loops
All checks were successful
Build and Release / Create Release (push) Successful in 8s
Build and Release / Unit Tests (push) Successful in 3m12s
Build and Release / Lint (push) Successful in 4m56s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 3m54s
Build and Release / Build Binaries (amd64, darwin) (push) Successful in 3m1s
Build and Release / Build Binaries (arm64, darwin) (push) Successful in 3m7s
Build and Release / Build Binaries (amd64, windows) (push) Successful in 3m38s
Build and Release / Build Binaries (amd64, linux) (push) Successful in 4m5s
Build and Release / Build Binaries (arm64, linux) (push) Successful in 2m42s
- Fix gofmt formatting in modules/pages/config.go
- Fix gofmt formatting in routers/web/repo/setting/pages.go
- Modernize for loops to use range over int (Go 1.22+)
- Use strings.SplitSeq for efficient iteration (Go 1.24+)

🤖 Generated with Claude Code
2026-01-13 06:24:19 +00:00
2 changed files with 20 additions and 15 deletions

View File

@@ -147,10 +147,10 @@ type CTASectionConfig struct {
// FooterConfig represents footer settings
type FooterConfig struct {
Links []FooterLink `yaml:"links,omitempty"`
Social []SocialLink `yaml:"social,omitempty"`
Copyright string `yaml:"copyright,omitempty"`
ShowPoweredBy bool `yaml:"show_powered_by,omitempty"`
Links []FooterLink `yaml:"links,omitempty"`
Social []SocialLink `yaml:"social,omitempty"`
Copyright string `yaml:"copyright,omitempty"`
ShowPoweredBy bool `yaml:"show_powered_by,omitempty"`
}
// FooterLink represents a single footer link

View File

@@ -5,8 +5,8 @@ package setting
import (
"fmt"
"strings"
"net/http"
"strings"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/modules/json"
@@ -261,7 +261,7 @@ func PagesContent(ctx *context.Context) {
func PagesContentPost(ctx *context.Context) {
config := getPagesLandingConfig(ctx)
config.Stats = nil
for i := 0; i < 10; i++ {
for i := range 10 {
value := ctx.FormString(fmt.Sprintf("stat_value_%d", i))
label := ctx.FormString(fmt.Sprintf("stat_label_%d", i))
if value == "" && label == "" {
@@ -270,7 +270,7 @@ func PagesContentPost(ctx *context.Context) {
config.Stats = append(config.Stats, pages_module.StatConfig{Value: value, Label: label})
}
config.ValueProps = nil
for i := 0; i < 10; i++ {
for i := range 10 {
title := ctx.FormString(fmt.Sprintf("valueprop_title_%d", i))
desc := ctx.FormString(fmt.Sprintf("valueprop_desc_%d", i))
icon := ctx.FormString(fmt.Sprintf("valueprop_icon_%d", i))
@@ -280,7 +280,7 @@ func PagesContentPost(ctx *context.Context) {
config.ValueProps = append(config.ValueProps, pages_module.ValuePropConfig{Title: title, Description: desc, Icon: icon})
}
config.Features = nil
for i := 0; i < 20; i++ {
for i := range 20 {
title := ctx.FormString(fmt.Sprintf("feature_title_%d", i))
desc := ctx.FormString(fmt.Sprintf("feature_desc_%d", i))
icon := ctx.FormString(fmt.Sprintf("feature_icon_%d", i))
@@ -309,7 +309,7 @@ func PagesSocial(ctx *context.Context) {
func PagesSocialPost(ctx *context.Context) {
config := getPagesLandingConfig(ctx)
config.SocialProof.Logos = nil
for i := 0; i < 20; i++ {
for i := range 20 {
logo := ctx.FormString(fmt.Sprintf("logo_%d", i))
if logo == "" {
continue
@@ -317,7 +317,7 @@ func PagesSocialPost(ctx *context.Context) {
config.SocialProof.Logos = append(config.SocialProof.Logos, logo)
}
config.SocialProof.Testimonials = nil
for i := 0; i < 10; i++ {
for i := range 10 {
quote := ctx.FormString(fmt.Sprintf("testimonial_quote_%d", i))
author := ctx.FormString(fmt.Sprintf("testimonial_author_%d", i))
role := ctx.FormString(fmt.Sprintf("testimonial_role_%d", i))
@@ -348,7 +348,7 @@ func PagesPricingPost(ctx *context.Context) {
config.Pricing.Headline = ctx.FormString("pricing_headline")
config.Pricing.Subheadline = ctx.FormString("pricing_subheadline")
config.Pricing.Plans = nil
for i := 0; i < 5; i++ {
for i := range 5 {
name := ctx.FormString(fmt.Sprintf("plan_name_%d", i))
price := ctx.FormString(fmt.Sprintf("plan_price_%d", i))
if name == "" && price == "" {
@@ -356,7 +356,7 @@ func PagesPricingPost(ctx *context.Context) {
}
featuresText := ctx.FormString(fmt.Sprintf("plan_%d_features", i))
var features []string
for _, f := range strings.Split(featuresText, "\n") {
for f := range strings.SplitSeq(featuresText, "\n") {
f = strings.TrimSpace(f)
if f != "" {
features = append(features, f)
@@ -393,7 +393,7 @@ func PagesFooterPost(ctx *context.Context) {
config.CTASection.Button.Variant = ctx.FormString("cta_button_variant")
config.Footer.Copyright = ctx.FormString("footer_copyright")
config.Footer.Links = nil
for i := 0; i < 10; i++ {
for i := range 10 {
label := ctx.FormString(fmt.Sprintf("footer_link_label_%d", i))
url := ctx.FormString(fmt.Sprintf("footer_link_url_%d", i))
if label == "" && url == "" {
@@ -402,7 +402,7 @@ func PagesFooterPost(ctx *context.Context) {
config.Footer.Links = append(config.Footer.Links, pages_module.FooterLink{Label: label, URL: url})
}
config.Footer.Social = nil
for i := 0; i < 10; i++ {
for i := range 10 {
platform := ctx.FormString(fmt.Sprintf("social_platform_%d", i))
url := ctx.FormString(fmt.Sprintf("social_url_%d", i))
if platform == "" && url == "" {
@@ -433,7 +433,12 @@ func PagesThemePost(ctx *context.Context) {
config.Theme.Mode = ctx.FormString("theme_mode")
config.SEO.Title = ctx.FormString("seo_title")
config.SEO.Description = ctx.FormString("seo_description")
keywords := ctx.FormString("seo_keywords"); if keywords != "" { config.SEO.Keywords = strings.Split(keywords, ",") } else { config.SEO.Keywords = nil }
keywords := ctx.FormString("seo_keywords")
if keywords != "" {
config.SEO.Keywords = strings.Split(keywords, ",")
} else {
config.SEO.Keywords = nil
}
config.SEO.OGImage = ctx.FormString("og_image")
if err := savePagesLandingConfig(ctx, config); err != nil {
ctx.ServerError("SavePagesConfig", err)