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:
parent
6c11ecd9ab
commit
dca59d52b6
113 changed files with 222 additions and 287 deletions
|
|
@ -128,7 +128,7 @@ func TestClientRemotes(t *testing.T) {
|
|||
`
|
||||
f, err := os.OpenFile(remoteFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0755)
|
||||
assert.NoError(t, err)
|
||||
_, err = f.Write([]byte(remotes))
|
||||
_, err = f.WriteString(remotes)
|
||||
assert.NoError(t, err)
|
||||
err = f.Close()
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -165,7 +165,7 @@ func TestClientRemotes_no_resolved_remote(t *testing.T) {
|
|||
`
|
||||
f, err := os.OpenFile(remoteFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0755)
|
||||
assert.NoError(t, err)
|
||||
_, err = f.Write([]byte(remotes))
|
||||
_, err = f.WriteString(remotes)
|
||||
assert.NoError(t, err)
|
||||
err = f.Close()
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -1141,6 +1141,7 @@ func TestClientParsePushRevision(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRemoteTrackingRef(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("parsing", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
@ -2098,6 +2099,7 @@ func TestCredentialPatternFromHost(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPushDefault(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("it parses valid values correctly", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ func TestOutput(t *testing.T) {
|
|||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
||||
cmd := Command{
|
||||
&exec.Cmd{
|
||||
Path: createMockExecutable(t, tt.stdout, tt.stderr, tt.exitCode),
|
||||
|
|
@ -87,7 +86,6 @@ func createMockExecutable(t *testing.T, stdout string, stderr string, exitCode i
|
|||
t.Fatalf("failed to compile: %v\n%s", err, out)
|
||||
}
|
||||
return binaryPath
|
||||
|
||||
}
|
||||
|
||||
func buildCommandSourceCode(exitCode int, stdout, stderr string) string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue