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

@ -52,7 +52,6 @@ func addTemplateFlag(f *pflag.FlagSet, shorthand string) {
}
func setupJsonFlags(cmd *cobra.Command, exportTarget *Exporter, fields []string) {
_ = cmd.RegisterFlagCompletionFunc("json", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
var results []string
var prefix string
@ -264,7 +263,7 @@ func (e *jsonExporter) exportData(v reflect.Value) interface{} {
}
case reflect.Slice:
a := make([]interface{}, v.Len())
for i := 0; i < v.Len(); i++ {
for i := range v.Len() {
a[i] = e.exportData(v.Index(i))
}
return a

View file

@ -142,7 +142,6 @@ func TestAddJSONFlagsWithoutShorthand(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
cmd := &cobra.Command{Run: func(*cobra.Command, []string) {}}
tt.setFlags(cmd)