diff --git a/local_install_test.go b/local_install_test.go index 69f29152..1f96d90b 100644 --- a/local_install_test.go +++ b/local_install_test.go @@ -10,6 +10,7 @@ import ( "os" "os/exec" "path/filepath" + "slices" "strings" "sync" "testing" @@ -508,10 +509,8 @@ func TestIntegrationLocalInstallGenerateSRCINFO(t *testing.T) { } captureOverride := func(cmd *exec.Cmd) (stdout string, stderr string, err error) { - for _, arg := range cmd.Args { - if arg == "--printsrcinfo" { - return string(srcinfo), "", nil - } + if slices.Contains(cmd.Args, "--printsrcinfo") { + return string(srcinfo), "", nil } return strings.Join(tars, "\n"), "", nil } diff --git a/pkg/db/ialpm/alpm.go b/pkg/db/ialpm/alpm.go index 383b25f4..dffc7230 100644 --- a/pkg/db/ialpm/alpm.go +++ b/pkg/db/ialpm/alpm.go @@ -529,14 +529,14 @@ func (ae *AlpmExecutor) AlpmArchitectures() ([]string, error) { } func alpmSetLogCallback(alpmHandle *alpm.Handle, cb func(alpm.LogLevel, string)) { - alpmHandle.SetLogCallback(func(ctx interface{}, lvl alpm.LogLevel, msg string) { + alpmHandle.SetLogCallback(func(ctx any, lvl alpm.LogLevel, msg string) { cbo := ctx.(func(alpm.LogLevel, string)) cbo(lvl, msg) }, cb) } func alpmSetQuestionCallback(alpmHandle *alpm.Handle, cb func(alpm.QuestionAny)) { - alpmHandle.SetQuestionCallback(func(ctx interface{}, q alpm.QuestionAny) { + alpmHandle.SetQuestionCallback(func(ctx any, q alpm.QuestionAny) { cbo := ctx.(func(alpm.QuestionAny)) cbo(q) }, cb) diff --git a/pkg/db/types.go b/pkg/db/types.go index 0fa6059f..77584ee5 100644 --- a/pkg/db/types.go +++ b/pkg/db/types.go @@ -1,15 +1,11 @@ package db +import "slices" + func ArchIsSupported(alpmArch []string, arch string) bool { if arch == "any" { return true } - for _, a := range alpmArch { - if a == arch { - return true - } - } - - return false + return slices.Contains(alpmArch, arch) } diff --git a/pkg/dep/dep_graph.go b/pkg/dep/dep_graph.go index d7d759f8..1009673e 100644 --- a/pkg/dep/dep_graph.go +++ b/pkg/dep/dep_graph.go @@ -244,8 +244,6 @@ func (g *Grapher) GraphFromSrcInfos(ctx context.Context, graph *topo.Graph[strin aurPkgsAdded := []*aurc.Pkg{} for pkgBuildDir, pkgbuild := range srcInfos { - pkgBuildDir := pkgBuildDir - aurPkgs, err := makeAURPKGFromSrcinfo(g.dbExecutor, pkgbuild) if err != nil { return nil, err @@ -260,8 +258,6 @@ func (g *Grapher) GraphFromSrcInfos(ctx context.Context, graph *topo.Graph[strin } for _, pkg := range aurPkgs { - pkg := pkg - reason := Explicit if pkg := g.dbExecutor.LocalPackage(pkg.Name); pkg != nil { reason = Reason(pkg.Reason()) diff --git a/pkg/dep/topo/dep.go b/pkg/dep/topo/dep.go index 61e880f4..30a8e392 100644 --- a/pkg/dep/topo/dep.go +++ b/pkg/dep/topo/dep.go @@ -2,6 +2,7 @@ package topo import ( "fmt" + "maps" "strings" "github.com/Jguer/go-alpm/v2" @@ -344,9 +345,7 @@ func (g *Graph[T, V]) buildTransitive(root T, nextFn func(T) NodeSet[T]) NodeSet func (s NodeSet[T]) copy() NodeSet[T] { out := make(NodeSet[T], len(s)) - for k, v := range s { - out[k] = v - } + maps.Copy(out, s) return out } diff --git a/pkg/download/abs_test.go b/pkg/download/abs_test.go index 8ce7986a..3f9c6ed2 100644 --- a/pkg/download/abs_test.go +++ b/pkg/download/abs_test.go @@ -123,7 +123,6 @@ func Test_getPackageURL(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() got := getPackagePKGBUILDURL(tt.args.pkgName) @@ -174,7 +173,6 @@ func TestGetABSPkgbuild(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() httpClient := &testClient{ @@ -257,7 +255,6 @@ func Test_getPackageRepoURL(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() got := getPackageRepoURL(tt.args.pkgName) diff --git a/pkg/download/aur_test.go b/pkg/download/aur_test.go index d4803e01..ec48a445 100644 --- a/pkg/download/aur_test.go +++ b/pkg/download/aur_test.go @@ -55,7 +55,6 @@ func TestGetAURPkgbuild(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() httpClient := &testClient{ diff --git a/pkg/intrange/intrange_test.go b/pkg/intrange/intrange_test.go index ab9becff..18856271 100644 --- a/pkg/intrange/intrange_test.go +++ b/pkg/intrange/intrange_test.go @@ -123,7 +123,6 @@ func TestIntRange_Get(t *testing.T) { {name: "normal end range false", fields: fields{1, 2}, args: args{3}, want: false}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() r := IntRange{ @@ -183,7 +182,6 @@ func TestIntRanges_Get(t *testing.T) { {name: "normal end range false", rs: IntRanges{{1, 2}}, args: args{3}, want: false}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() if got := tt.rs.Get(tt.args.n); got != tt.want { diff --git a/pkg/menus/edit_menu.go b/pkg/menus/edit_menu.go index 7100e5ba..74981f60 100644 --- a/pkg/menus/edit_menu.go +++ b/pkg/menus/edit_menu.go @@ -103,7 +103,7 @@ func editPkgbuilds(log *text.Logger, pkgbuildDirs map[string]string, bases []str if len(pkgbuilds) > 0 { editor, editorArgs := editor(log, editorConfig, editorFlags, noConfirm) editorArgs = append(editorArgs, pkgbuilds...) - editcmd := exec.Command(editor, editorArgs...) + editcmd := exec.CommandContext(context.Background(), editor, editorArgs...) editcmd.Stdin, editcmd.Stdout, editcmd.Stderr = os.Stdin, os.Stdout, os.Stderr if err := editcmd.Run(); err != nil { diff --git a/pkg/news/news_test.go b/pkg/news/news_test.go index c7c4f219..01d489ac 100644 --- a/pkg/news/news_test.go +++ b/pkg/news/news_test.go @@ -129,7 +129,6 @@ func TestPrintNewsFeed(t *testing.T) { } t.Setenv("TZ", "UTC") for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { gock.New("https://archlinux.org"). Get("/feeds/news"). diff --git a/pkg/query/query_builder.go b/pkg/query/query_builder.go index cc431e58..e91730f6 100644 --- a/pkg/query/query_builder.go +++ b/pkg/query/query_builder.go @@ -43,7 +43,7 @@ type SourceQueryBuilder struct { sortBy string searchBy string targetMode parser.TargetMode - queryMap map[string]map[string]interface{} + queryMap map[string]map[string]any bottomUp bool singleLineResults bool separateSources bool @@ -71,7 +71,7 @@ func NewSourceQueryBuilder( searchBy: searchBy, singleLineResults: singleLineResults, separateSources: separateSources, - queryMap: map[string]map[string]interface{}{}, + queryMap: map[string]map[string]any{}, results: make([]abstractResult, 0, 100), } } @@ -154,7 +154,7 @@ func (s *SourceQueryBuilder) Execute(ctx context.Context, dbExecutor db.Executor for i := range aurResults { if s.queryMap[dbName] == nil { - s.queryMap[dbName] = map[string]interface{}{} + s.queryMap[dbName] = map[string]any{} } by := getSearchBy(s.searchBy) @@ -182,7 +182,7 @@ func (s *SourceQueryBuilder) Execute(ctx context.Context, dbExecutor db.Executor for i := range repoResults { dbName := repoResults[i].DB().Name() if s.queryMap[dbName] == nil { - s.queryMap[dbName] = map[string]interface{}{} + s.queryMap[dbName] = map[string]any{} } s.queryMap[dbName][repoResults[i].Name()] = repoResults[i] diff --git a/pkg/settings/exe/cmd_builder.go b/pkg/settings/exe/cmd_builder.go index 7924f360..5b3d99e1 100644 --- a/pkg/settings/exe/cmd_builder.go +++ b/pkg/settings/exe/cmd_builder.go @@ -284,7 +284,7 @@ func (c *CmdBuilder) sudoLoopBackground() { func (c *CmdBuilder) updateSudo() { for { - err := c.Show(exec.Command(c.SudoBin, "-v")) + err := c.Show(exec.CommandContext(context.Background(), c.SudoBin, "-v")) if err != nil { c.Log.Errorln(err) } else { diff --git a/pkg/settings/exe/mock.go b/pkg/settings/exe/mock.go index 31a1f896..eff69eb9 100644 --- a/pkg/settings/exe/mock.go +++ b/pkg/settings/exe/mock.go @@ -10,8 +10,8 @@ import ( ) type Call struct { - Res []interface{} - Args []interface{} + Res []any + Args []any Dir string } @@ -51,8 +51,8 @@ func (m *MockBuilder) BuildMakepkgCmd(ctx context.Context, dir string, extraArgs m.BuildMakepkgCmdCallsMu.Lock() m.BuildMakepkgCmdCalls = append(m.BuildMakepkgCmdCalls, Call{ - Res: []interface{}{res}, - Args: []interface{}{ + Res: []any{res}, + Args: []any{ ctx, dir, extraArgs, @@ -103,7 +103,7 @@ func (m *MockBuilder) GetKeepSrc() bool { func (m *MockRunner) Capture(cmd *exec.Cmd) (stdout, stderr string, err error) { m.CaptureCallsMu.Lock() m.CaptureCalls = append(m.CaptureCalls, Call{ - Args: []interface{}{ + Args: []any{ cmd, }, Dir: cmd.Dir, @@ -125,7 +125,7 @@ func (m *MockRunner) Show(cmd *exec.Cmd) error { m.ShowCallsMu.Lock() m.ShowCalls = append(m.ShowCalls, Call{ - Args: []interface{}{ + Args: []any{ cmd, }, Dir: cmd.Dir, diff --git a/pkg/settings/parser/parser.go b/pkg/settings/parser/parser.go index 52150007..d14e9209 100644 --- a/pkg/settings/parser/parser.go +++ b/pkg/settings/parser/parser.go @@ -4,6 +4,7 @@ import ( "bufio" "errors" "fmt" + "maps" "os" "strings" @@ -87,9 +88,7 @@ func (a *Arguments) Copy() (cp *Arguments) { cp.Op = a.Op - for k, v := range a.Options { - cp.Options[k] = v - } + maps.Copy(cp.Options, a.Options) cp.Targets = make([]string, len(a.Targets)) copy(cp.Targets, a.Targets) diff --git a/pkg/settings/parser/parser_test.go b/pkg/settings/parser/parser_test.go index a1628c8b..51d03bb0 100644 --- a/pkg/settings/parser/parser_test.go +++ b/pkg/settings/parser/parser_test.go @@ -37,7 +37,6 @@ func TestOption_Add(t *testing.T) { }, want: []string{"c"}}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() o := &Option{ @@ -75,7 +74,6 @@ func TestOption_Set(t *testing.T) { }, want: []string{"c"}}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() o := &Option{ @@ -105,7 +103,6 @@ func TestOption_First(t *testing.T) { }, want: ""}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() o := &Option{ @@ -158,7 +155,6 @@ func TestArguments_CopyGlobal(t *testing.T) { }}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() cmdArgs := &Arguments{ @@ -207,7 +203,6 @@ func TestArguments_Copy(t *testing.T) { }}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() cmdArgs := &Arguments{ @@ -265,7 +260,6 @@ func TestArguments_FormatArgs(t *testing.T) { }, wantArgs: []string{"-Y", "--overwrite", "/tmp/a", "--overwrite", "/tmp/b", "--overwrite", "/tmp/c", "--needed"}}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() cmdArgs := &Arguments{ @@ -313,7 +307,6 @@ func TestArguments_FormatGlobalArgs(t *testing.T) { }, wantArgs: []string(nil)}, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() cmdArgs := &Arguments{ diff --git a/pkg/sync/build/installer.go b/pkg/sync/build/installer.go index a9362364..84f2f8c7 100644 --- a/pkg/sync/build/installer.go +++ b/pkg/sync/build/installer.go @@ -3,6 +3,7 @@ package build import ( "context" "fmt" + "maps" "os" "github.com/Jguer/yay/v12/pkg/db" @@ -126,9 +127,7 @@ func (installer *Installer) Install(ctx context.Context, } func mergeLayers(layer1, layer2 map[string]*dep.InstallInfo) map[string]*dep.InstallInfo { - for name, info := range layer2 { - layer1[name] = info - } + maps.Copy(layer1, layer2) return layer1 } diff --git a/pkg/sync/build/installer_test.go b/pkg/sync/build/installer_test.go index 295cc92f..f3e88007 100644 --- a/pkg/sync/build/installer_test.go +++ b/pkg/sync/build/installer_test.go @@ -88,7 +88,6 @@ func TestInstaller_InstallNeeded(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.desc, func(td *testing.T) { tmpDir := td.TempDir() pkgTar := tmpDir + "/yay-91.0.0-1-x86_64.pkg.tar.zst" @@ -356,7 +355,6 @@ func TestInstaller_InstallMixedSourcesAndLayers(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.desc, func(td *testing.T) { pkgTar := tmpDir + "/yay-91.0.0-1-x86_64.pkg.tar.zst" jfinPkgTar := tmpDirJfin + "/jellyfin-server-10.8.8-1-x86_64.pkg.tar.zst" @@ -561,7 +559,6 @@ func TestInstaller_CompileFailed(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.desc, func(td *testing.T) { pkgTar := tmpDir + "/yay-91.0.0-1-x86_64.pkg.tar.zst" @@ -718,7 +715,6 @@ func TestInstaller_InstallSplitPackage(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.desc, func(td *testing.T) { pkgTars := []string{ tmpDir + "/jellyfin-10.8.4-1-x86_64.pkg.tar.zst", @@ -854,7 +850,6 @@ func TestInstaller_InstallDownloadOnly(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.desc, func(td *testing.T) { tmpDir := td.TempDir() pkgTar := tmpDir + "/yay-91.0.0-1-x86_64.pkg.tar.zst" @@ -979,7 +974,6 @@ func TestInstaller_InstallGroup(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.desc, func(td *testing.T) { tmpDir := td.TempDir() @@ -1176,7 +1170,6 @@ func TestInstaller_InstallRebuild(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.desc, func(td *testing.T) { tmpDir := td.TempDir() pkgTar := tmpDir + "/yay-91.0.0-1-x86_64.pkg.tar.zst" @@ -1294,7 +1287,6 @@ func TestInstaller_InstallUpgrade(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.desc, func(td *testing.T) { mockDB := &mock.DBExecutor{} mockRunner := &exe.MockRunner{} @@ -1391,7 +1383,6 @@ func TestInstaller_KeepSrc(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.desc, func(td *testing.T) { tmpDir := td.TempDir() pkgTar := tmpDir + "/yay-92.0.0-1-x86_64.pkg.tar.zst" diff --git a/pkg/sync/build/pkg_archive_test.go b/pkg/sync/build/pkg_archive_test.go index d2d713f9..733e6270 100644 --- a/pkg/sync/build/pkg_archive_test.go +++ b/pkg/sync/build/pkg_archive_test.go @@ -133,7 +133,7 @@ func TestParsePackageList(t *testing.T) { } for _, tc := range testCases { - tc := tc // capture range variable + // capture range variable t.Run(tc.desc, func(t *testing.T) { t.Parallel() diff --git a/pkg/sync/srcinfo/pgp/keys_test.go b/pkg/sync/srcinfo/pgp/keys_test.go index c1f3e8ea..c5583bf9 100644 --- a/pkg/sync/srcinfo/pgp/keys_test.go +++ b/pkg/sync/srcinfo/pgp/keys_test.go @@ -220,7 +220,6 @@ func TestCheckPgpKeys(t *testing.T) { } for _, tt := range testcases { - tt := tt t.Run(tt.name, func(t *testing.T) { mockRunner := &exe.MockRunner{ ShowFn: tt.showFn, diff --git a/pkg/sync/workdir/aur_source_test.go b/pkg/sync/workdir/aur_source_test.go index dd141f97..a83cf32e 100644 --- a/pkg/sync/workdir/aur_source_test.go +++ b/pkg/sync/workdir/aur_source_test.go @@ -80,7 +80,6 @@ func Test_downloadPKGBUILDSource(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.desc, func(td *testing.T) { cmdBuilder := &TestMakepkgBuilder{ parentBuilder: &exe.CmdBuilder{ diff --git a/pkg/text/service.go b/pkg/text/service.go index 71105f88..c9ff301b 100644 --- a/pkg/text/service.go +++ b/pkg/text/service.go @@ -38,7 +38,7 @@ func (l *Logger) Debugln(a ...any) { return } - l.Println(append([]interface{}{ + l.Println(append([]any{ Bold(yellow(fmt.Sprintf("[DEBUG:%s]", l.name))), }, a...)...) } @@ -52,15 +52,15 @@ func (l *Logger) OperationInfo(a ...any) { } func (l *Logger) SprintOperationInfo(a ...any) string { - return fmt.Sprint(append([]interface{}{Bold(Cyan(opSymbol + " ")), boldCode}, a...)...) + ResetCode + return fmt.Sprint(append([]any{Bold(Cyan(opSymbol + " ")), boldCode}, a...)...) + ResetCode } func (l *Logger) Info(a ...any) { - l.Print(append([]interface{}{Bold(Green(arrow + " "))}, a...)...) + l.Print(append([]any{Bold(Green(arrow + " "))}, a...)...) } func (l *Logger) Infoln(a ...any) { - l.Println(append([]interface{}{Bold(Green(arrow))}, a...)...) + l.Println(append([]any{Bold(Green(arrow))}, a...)...) } func (l *Logger) Warn(a ...any) { @@ -72,7 +72,7 @@ func (l *Logger) Warnln(a ...any) { } func (l *Logger) SprintWarn(a ...any) string { - return fmt.Sprint(append([]interface{}{Bold(yellow(smallArrow + " "))}, a...)...) + return fmt.Sprint(append([]any{Bold(yellow(smallArrow + " "))}, a...)...) } func (l *Logger) Error(a ...any) { @@ -84,7 +84,7 @@ func (l *Logger) Errorln(a ...any) { } func (l *Logger) SprintError(a ...any) string { - return fmt.Sprint(append([]interface{}{Bold(Red(smallArrow + " "))}, a...)...) + return fmt.Sprint(append([]any{Bold(Red(smallArrow + " "))}, a...)...) } func (l *Logger) Printf(format string, a ...any) { diff --git a/pkg/text/text.go b/pkg/text/text.go index f88661ee..b6e7691f 100644 --- a/pkg/text/text.go +++ b/pkg/text/text.go @@ -23,10 +23,7 @@ func SplitDBFromName(pkg string) (db, name string) { // LessRunes compares two rune values, and returns true if the first argument is lexicographicaly smaller. func LessRunes(iRunes, jRunes []rune) bool { - maxLen := len(iRunes) - if maxLen > len(jRunes) { - maxLen = len(jRunes) - } + maxLen := min(len(iRunes), len(jRunes)) for idx := 0; idx < maxLen; idx++ { ir := iRunes[idx] diff --git a/pkg/text/text_test.go b/pkg/text/text_test.go index 71a5f0bd..aa3b3e83 100644 --- a/pkg/text/text_test.go +++ b/pkg/text/text_test.go @@ -40,7 +40,6 @@ func TestLessRunes(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() got := LessRunes(tt.args.iRunes, tt.args.jRunes) diff --git a/pkg/upgrade/service_test.go b/pkg/upgrade/service_test.go index 78828e0b..d3800162 100644 --- a/pkg/upgrade/service_test.go +++ b/pkg/upgrade/service_test.go @@ -885,7 +885,6 @@ func TestUpgradeService_GraphUpgrades_zfs_dkms(t *testing.T) { } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() dbExe := &mock.DBExecutor{ diff --git a/pkg/upgrade/sources_test.go b/pkg/upgrade/sources_test.go index a01329e0..ebc63448 100644 --- a/pkg/upgrade/sources_test.go +++ b/pkg/upgrade/sources_test.go @@ -122,7 +122,6 @@ func Test_upAUR(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() @@ -228,7 +227,6 @@ func Test_upDevel(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() got := UpDevel(context.Background(), diff --git a/pkg/vcs/mock.go b/pkg/vcs/mock.go index 1224f332..9f51fa7f 100644 --- a/pkg/vcs/mock.go +++ b/pkg/vcs/mock.go @@ -2,6 +2,7 @@ package vcs import ( "context" + "slices" "github.com/Jguer/go-alpm/v2" gosrc "github.com/Morganamilo/go-srcinfo" @@ -13,12 +14,7 @@ type Mock struct { } func (m *Mock) ToUpgrade(ctx context.Context, pkgName string) bool { - for _, pkg := range m.ToUpgradeReturn { - if pkg == pkgName { - return true - } - } - return false + return slices.Contains(m.ToUpgradeReturn, pkgName) } func (m *Mock) Update(ctx context.Context, pkgName string, sources []gosrc.ArchString) { diff --git a/pkg/vcs/vcs.go b/pkg/vcs/vcs.go index d45a6c93..32978603 100644 --- a/pkg/vcs/vcs.go +++ b/pkg/vcs/vcs.go @@ -7,6 +7,7 @@ import ( "fmt" "os" "os/exec" + "slices" "strings" "sync" "time" @@ -170,14 +171,7 @@ func parseSource(source string) (url, branch string, protocols []string) { protocols = strings.SplitN(split[0], "+", 2) - git := false - - for _, protocol := range protocols { - if protocol == "git" { - git = true - break - } - } + git := slices.Contains(protocols, "git") protocols = protocols[len(protocols)-1:] diff --git a/pkg/vcs/vcs_test.go b/pkg/vcs/vcs_test.go index 873e3ad9..d5e76991 100644 --- a/pkg/vcs/vcs_test.go +++ b/pkg/vcs/vcs_test.go @@ -84,7 +84,6 @@ func TestNewInfoStore(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() got := NewInfoStore(tt.args.filePath, tt.args.cmdBuilder, @@ -231,7 +230,6 @@ func TestInfoStoreToUpgrade(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() v := &InfoStore{ @@ -364,7 +362,6 @@ func TestInfoStore_NeedsUpdate(t *testing.T) { }, } for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() v := &InfoStore{ @@ -413,7 +410,6 @@ func TestInfoStore_Update(t *testing.T) { require.NoError(t, err) for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() v := &InfoStore{ @@ -476,7 +472,6 @@ func TestInfoStore_Remove(t *testing.T) { require.NoError(t, err) for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() v := &InfoStore{ @@ -524,7 +519,6 @@ func TestInfoStore_CleanOrphans(t *testing.T) { require.NoError(t, err) for _, tt := range tests { - tt := tt t.Run(tt.name, func(t *testing.T) { t.Parallel() v := &InfoStore{ diff --git a/print.go b/print.go index 243de295..08b0ebef 100644 --- a/print.go +++ b/print.go @@ -73,7 +73,7 @@ func biggestPackages(logger *text.Logger, dbExecutor db.Executor) { return } - for i := 0; i < 10; i++ { + for i := range 10 { logger.Printf("%s: %s\n", text.Bold(pkgS[i].Name()), text.Cyan(text.Human(pkgS[i].ISize()))) } } diff --git a/sync_test.go b/sync_test.go index 13abe6dc..e1c6ca32 100644 --- a/sync_test.go +++ b/sync_test.go @@ -630,7 +630,6 @@ func TestSyncUpgrade_NoCombinedUpgrade(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() makepkgBin := t.TempDir() + "/makepkg"