Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
refactor: omit unnecessary reassignment
Signed-off-by: claudecodering <claudecoder@outlook.com>
  • Loading branch information
claudecodering committed Oct 31, 2025
commit 4e1ac97f6626179604245e32c9f5308919f0b423
1 change: 0 additions & 1 deletion commands/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,6 @@ func (c *serverCommand) serve() error {
defer cancel()
wg2, ctx := errgroup.WithContext(ctx)
for _, srv := range servers {
srv := srv
wg2.Go(func() error {
return srv.Shutdown(ctx)
})
Expand Down
1 change: 0 additions & 1 deletion common/hashing/hashing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ func TestXxHashFromReaderPara(t *testing.T) {

var wg sync.WaitGroup
for i := range 10 {
i := i
wg.Add(1)
go func() {
defer wg.Done()
Expand Down
1 change: 0 additions & 1 deletion common/para/para_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func TestPara(t *testing.T) {
var result []int
var mu sync.Mutex
for i := range n {
i := i
r.Run(func() error {
mu.Lock()
defer mu.Unlock()
Expand Down
1 change: 0 additions & 1 deletion config/defaultConfigProvider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ func TestDefaultConfigProvider(t *testing.T) {
}

for i := range 20 {
i := i
r.Run(func() error {
const v = 42
k := fmt.Sprintf("k%d", i)
Expand Down
1 change: 0 additions & 1 deletion create/content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ func TestNewContentFromFile(t *testing.T) {
c := qt.New(t)

for i, cas := range cases {
cas := cas

c.Run(cas.name, func(c *qt.C) {
c.Parallel()
Expand Down
1 change: 0 additions & 1 deletion hugolib/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,6 @@ themeconfigdirparam: {{ site.Params.themeconfigdirparam }}
`

for _, configName := range []string{"hugo.toml", "config.toml"} {
configName := configName
t.Run(configName, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion hugolib/content_map_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ Path: {{ .Path }}|{{.Kind }}
`

for _, format := range []string{"toml", "yaml", "json"} {
format := format
t.Run(format, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion hugolib/content_render_hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ Image: ![alt-"<>&](/destination-"<> 'title-"<>&')
`

for _, enabled := range []bool{true, false} {
enabled := enabled
t.Run(fmt.Sprint(enabled), func(t *testing.T) {
t.Parallel()
b := Test(t, strings.ReplaceAll(files, "ENABLE", fmt.Sprint(enabled)))
Expand Down
1 change: 0 additions & 1 deletion hugolib/doctree/nodeshiftree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ func TestTreePara(t *testing.T) {
)

for i := range 8 {
i := i
r.Run(func() error {
a := &testValue{ID: "/a"}
lock := tree.Lock(true)
Expand Down
2 changes: 0 additions & 2 deletions hugolib/hugo_sites_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ func (h *HugoSites) assemble(ctx context.Context, l logg.LevelLogger, bcfg *Buil

g, _ := h.workersSite.Start(ctx)
for _, s := range assemblers {
s := s
g.Run(func() error {
return s.assemblePagesStep1(ctx)
})
Expand Down Expand Up @@ -727,7 +726,6 @@ func (h *HugoSites) postProcess(l logg.LevelLogger) error {

filenames := h.Deps.BuildState.GetFilenamesWithPostPrefix()
for _, filename := range filenames {
filename := filename
g.Run(func() error {
return handleFile(filename)
})
Expand Down
2 changes: 0 additions & 2 deletions hugolib/page_permalink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ func TestPermalink(t *testing.T) {
}

for i, test := range tests {
i := i
test := test
t.Run(fmt.Sprintf("%s-%d", test.file, i), func(t *testing.T) {
t.Parallel()
c := qt.New(t)
Expand Down
1 change: 0 additions & 1 deletion hugolib/page_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,6 @@ func TestPageWithDate(t *testing.T) {

func TestPageWithFrontMatterConfig(t *testing.T) {
for _, dateHandler := range []string{":filename", ":fileModTime"} {
dateHandler := dateHandler
t.Run(fmt.Sprintf("dateHandler=%q", dateHandler), func(t *testing.T) {
t.Parallel()
c := qt.New(t)
Expand Down
1 change: 0 additions & 1 deletion hugolib/resource_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,6 @@ XML: {{ $xml.body }}
}

for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
if !test.shouldRun() {
t.Skip()
Expand Down
3 changes: 0 additions & 3 deletions hugolib/shortcode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ title: "Shortcodes Galore!"
{"inline", `{{< my.inline >}}Hi{{< /my.inline >}}`, regexpCheck("my.inline;inline:true;closing:true;inner:{Hi};")},
} {

test := test

t.Run(test.name, func(t *testing.T) {
t.Parallel()
c := qt.New(t)
Expand Down Expand Up @@ -644,7 +642,6 @@ String: {{ . | safeHTML }}

func TestInlineShortcodes(t *testing.T) {
for _, enableInlineShortcodes := range []bool{true, false} {
enableInlineShortcodes := enableInlineShortcodes
t.Run(fmt.Sprintf("enableInlineShortcodes=%t", enableInlineShortcodes),
func(t *testing.T) {
t.Parallel()
Expand Down
1 change: 0 additions & 1 deletion hugolib/site_output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (

func TestSiteWithPageOutputs(t *testing.T) {
for _, outputs := range [][]string{{"html", "json", "calendar"}, {"json"}} {
outputs := outputs
t.Run(fmt.Sprintf("%v", outputs), func(t *testing.T) {
t.Parallel()
doTestSiteWithPageOutputs(t, outputs)
Expand Down
1 change: 0 additions & 1 deletion hugolib/site_sections_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ PAG|{{ .Title }}|{{ $sect.InSection . }}
home := s.getPageOldVersion(kinds.KindHome)

for _, test := range tests {
test := test
tt.Run(fmt.Sprintf("sections %s", test.sections), func(c *qt.C) {
c.Parallel()
sections := strings.Split(test.sections, ",")
Expand Down
1 change: 0 additions & 1 deletion hugolib/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ func TestTemplateLookupOrder(t *testing.T) {
},
} {

this := this
if this.name != "Variant 1" {
continue
}
Expand Down
1 change: 0 additions & 1 deletion internal/warpc/warpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ func newDispatcher[Q, R any](opts Options) (*dispatcherPool[Q, R], error) {
run := func() error {
g, ctx := errgroup.WithContext(ctx)
for _, c := range inOuts {
c := c
g.Go(func() error {
var errBuff bytes.Buffer
ctx := context.WithoutCancel(ctx)
Expand Down
1 change: 0 additions & 1 deletion lazy/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ func TestInitBranchOrder(t *testing.T) {
ctx := context.Background()

for _, v := range inits {
v := v
wg.Add(1)
go func() {
defer wg.Done()
Expand Down
1 change: 0 additions & 1 deletion markup/goldmark/autoid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ tabspace
}

for i, input := range testlines {
input := input
expect := expectlines[i]
c.Run(input, func(c *qt.C) {
b := []byte(input)
Expand Down
1 change: 0 additions & 1 deletion markup/goldmark/codeblocks/codeblocks_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ Common
}{
{"issue-9819", "asdf\n: {#myid}"},
} {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
b := hugolib.NewIntegrationTestBuilder(
Expand Down
2 changes: 0 additions & 2 deletions resources/images/color_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func TestHexStringToColor(t *testing.T) {
{"777", color.RGBA{R: 0x77, G: 0x77, B: 0x77, A: 0xff}},
} {

test := test
c.Run(test.arg, func(c *qt.C) {
c.Parallel()

Expand Down Expand Up @@ -78,7 +77,6 @@ func TestColorToHexString(t *testing.T) {
{color.RGBA{R: 0x42, G: 0x87, B: 0xf5, A: 0x80}, "#4287f580"},
} {

test := test
c.Run(test.expect, func(c *qt.C) {
c.Parallel()

Expand Down
1 change: 0 additions & 1 deletion source/content_directory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func TestIgnoreDotFilesAndDirectories(t *testing.T) {
}

for i, test := range tests {
test := test
c.Run(fmt.Sprintf("[%d] %s", i, test.path), func(c *qt.C) {
c.Parallel()
v := config.New()
Expand Down
2 changes: 0 additions & 2 deletions tpl/collections/collections_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ func TestDictionary(t *testing.T) {
{[]any{5, "b"}, false},
{[]any{"a", "b", "c"}, false},
} {
i := i
test := test
c.Run(fmt.Sprint(i), func(c *qt.C) {
c.Parallel()
errMsg := qt.Commentf("[%d] %v", i, test.values)
Expand Down
3 changes: 0 additions & 3 deletions tpl/collections/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ func TestMerge(t *testing.T) {
{"all nil", []any{nil, nil}, nil, true},
} {

test := test
i := i

t.Run(test.name, func(t *testing.T) {
t.Parallel()
errMsg := qt.Commentf("[%d] %v", i, test)
Expand Down