Skip to content
Myr

fix test build breakage with go1.11 (#712)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

As discussed in golang/go#26109, vet typecheck is enabled in go1.11 and the command_test.go can't be compiled any more with go1.11 due to the unread variables in the command_test.go. Instead of removing the unused variables, this CL reads the variables and compares the values against the current behavior so when the related issue is fixed, this test can be updated accordingly.

authored by Hyang-Ah Hana Kim · committed by Eric Paris · parent 1e58aa3 · Browse files · 1 file+14 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+14 added−12 removed

  • other:+14 added−12 removed

1 file+14 added−12 removed

modified:command_test.go+14 added-12 removed
1162 unmodified lines
1163 if err != nil {1164 t.Errorf("Unexpected error: %v", err)1165 }11661167 // TODO: This test fails, but should not.1168 // Related to https://github.com/spf13/cobra/issues/252.1169 //1170 // if parentPersPreArgs != "one two" {1171 // t.Errorf("Expected parentPersPreArgs %q, got %q", "one two", parentPersPreArgs)1172 // }1167 // TODO: currently PersistenPreRun* defined in parent does not1168 // run if the matchin child subcommand has PersistenPreRun.1169 // If the behavior changes (https://github.com/spf13/cobra/issues/252)1170 // this test must be fixed.1171 if parentPersPreArgs != "" {1172 t.Errorf("Expected blank parentPersPreArgs, got %q", parentPersPreArgs)1173 }1174 if parentPreArgs != "" {1175 t.Errorf("Expected blank parentPreArgs, got %q", parentPreArgs)1176 }1177 if parentRunArgs != "" {
1 unmodified line
1179 }1180 if parentPostArgs != "" {1181 t.Errorf("Expected blank parentPostArgs, got %q", parentPostArgs)1182 }1182 // TODO: This test fails, but should not.1183 // Related to https://github.com/spf13/cobra/issues/252.1184 //1185 // if parentPersPostArgs != "one two" {1186 // t.Errorf("Expected parentPersPostArgs %q, got %q", "one two", parentPersPostArgs)1187 // }1183 // TODO: currently PersistenPostRun* defined in parent does not1184 // run if the matchin child subcommand has PersistenPostRun.1185 // If the behavior changes (https://github.com/spf13/cobra/issues/252)1186 // this test must be fixed.1187 if parentPersPostArgs != "" {1188 t.Errorf("Expected blank parentPersPostArgs, got %q", parentPersPostArgs)1189 }11901191 if childPersPreArgs != "one two" {1192 t.Errorf("Expected childPersPreArgs %q, got %q", "one two", childPersPreArgs)1193 }
542 unmodified lines