Fix linting issues: canonicalheader, embeddedstructfieldcheck, iotamixing, makezero, testableexamples, wastedassign, usetesting, tparallel, unconvert, intrange, iface

- canonicalheader: fix cacheTTL header value to canonical form
- embeddedstructfieldcheck: move embedded fields before regular fields in 4 structs
- iotamixing: split const blocks mixing iota with non-iota constants
- makezero: use make([]T, 0, n) instead of make([]T, n) before appending
- testableexamples: add missing Output: comment to ExampleOption_UnwrapOrZero
- wastedassign: remove wasted initial assignments in 4 locations
- usetesting: replace os.MkdirTemp/os.Setenv with t.TempDir/t.Setenv in tests
- tparallel: add t.Parallel() to 8 top-level test functions
- unconvert: remove 16 unnecessary type conversions
- intrange: convert 3 for loops to use integer range syntax
- iface: consolidate identical EditPrompter and Prompt interfaces via type alias

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-24 11:05:52 +00:00
parent 6c11ecd9ab
commit dca59d52b6
113 changed files with 222 additions and 287 deletions

View file

@ -74,7 +74,7 @@ func (e *Extension) URL() string {
}
case GitKind:
if remoteURL, err := e.gitClient.Config("remote.origin.url"); err == nil {
url = strings.TrimSpace(string(remoteURL))
url = strings.TrimSpace(remoteURL)
}
}
@ -196,7 +196,7 @@ func (e *Extension) Owner() string {
}
case GitKind:
if remoteURL, err := e.gitClient.Config("remote.origin.url"); err == nil {
if url, err := git.ParseURL(strings.TrimSpace(string(remoteURL))); err == nil {
if url, err := git.ParseURL(strings.TrimSpace(remoteURL)); err == nil {
if repo, err := ghrepo.FromURL(url); err == nil {
owner = repo.RepoOwner()
}

View file

@ -261,7 +261,7 @@ func TestManager_UpgradeExtensions(t *testing.T) {
exts, err := m.list(false)
assert.NoError(t, err)
assert.Equal(t, 3, len(exts))
for i := 0; i < 3; i++ {
for i := range 3 {
exts[i].currentVersion = "old version"
exts[i].latestVersion = "new version"
}
@ -300,7 +300,7 @@ func TestManager_UpgradeExtensions_DryRun(t *testing.T) {
exts, err := m.list(false)
assert.NoError(t, err)
assert.Equal(t, 3, len(exts))
for i := 0; i < 3; i++ {
for i := range 3 {
exts[i].currentVersion = fmt.Sprintf("%d", i)
exts[i].latestVersion = fmt.Sprintf("%d", i+1)
}
@ -1010,7 +1010,6 @@ func TestManager_Install_binary_pinned(t *testing.T) {
assert.Equal(t, "", stdout.String())
assert.Equal(t, "", stderr.String())
}
func TestManager_Install_binary_unsupported(t *testing.T) {