fix lint issues on master

pull/12252/head
Medya Gh 2021-08-12 17:38:24 -07:00
parent 5206f7fb39
commit 6aa7abc24a
10 changed files with 21 additions and 15 deletions

View File

@ -91,8 +91,8 @@ func selfRegistration(clientset *kubernetes.Clientset, caCert []byte) {
klog.Fatal(err2)
}
}
var failurePolicy v1.FailurePolicyType = v1.Fail
var sideEffects v1.SideEffectClass = v1.SideEffectClassNone
var failurePolicy = v1.Fail
var sideEffects = v1.SideEffectClassNone
webhookConfig := &v1.MutatingWebhookConfiguration{
ObjectMeta: metav1.ObjectMeta{

View File

@ -157,7 +157,8 @@ func runDelete(cmd *cobra.Command, args []string) {
if err != nil {
klog.Warningf("'error loading profiles in minikube home %q: %v", localpath.MiniPath(), err)
}
profilesToDelete := append(validProfiles, invalidProfiles...)
profilesToDelete := validProfiles
profilesToDelete = append(profilesToDelete, invalidProfiles...)
// in the case user has more than 1 profile and runs --purge
// to prevent abandoned VMs/containers, force user to run with delete --all
if purge && len(profilesToDelete) > 1 && !deleteAll {

View File

@ -221,7 +221,8 @@ func TestDeleteAllProfiles(t *testing.T) {
t.Errorf("ListProfiles length = %d, expected %d\nvalid: %v\ninvalid: %v\n", len(validProfiles)+len(inValidProfiles), numberOfTotalProfileDirs, validProfiles, inValidProfiles)
}
profiles := append(validProfiles, inValidProfiles...)
profiles := validProfiles
profiles = append(profiles, inValidProfiles...)
hostAndDirsDeleter = hostAndDirsDeleterMock
errs := DeleteProfiles(profiles)

View File

@ -72,7 +72,7 @@ func execute() error {
// Open non-autopause csv file of benchmark summary
napResults := []float64{}
var napFn string = "./out/benchmark-results/" + sessionID + "/cstat.nonautopause.summary"
napFn := "./out/benchmark-results/" + sessionID + "/cstat.nonautopause.summary"
napFile, err := os.Open(napFn)
if err != nil {
return errors.Wrap(err, "Missing summary csv")
@ -97,7 +97,7 @@ func execute() error {
// Open auto-pause csv file of benchmark summary
apResults := []float64{}
var apFn string = "./out/benchmark-results/" + sessionID + "/cstat.autopause.summary"
apFn := "./out/benchmark-results/" + sessionID + "/cstat.autopause.summary"
apFile, err := os.Open(apFn)
if err != nil {
return errors.Wrap(err, "Missing summary csv")

View File

@ -71,7 +71,7 @@ func execute() error {
// Open csv file of benchmark summary
results := []float64{}
var fn string = "./out/benchmark-results/" + sessionID + "/cstat.summary"
fn := "./out/benchmark-results/" + sessionID + "/cstat.summary"
file, err := os.Open(fn)
if err != nil {
return errors.Wrap(err, "Missing summary csv")

View File

@ -62,7 +62,7 @@ func Enable() error {
return errors.Wrap(err, "restarting containerd")
}
// When pod is terminated, disable gvisor and exit
c := make(chan os.Signal)
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
<-c

View File

@ -204,12 +204,15 @@ func generateProfileCerts(k8s config.KubernetesConfig, n config.Node, ccs CACert
return nil, errors.Wrap(err, "getting service cluster ip")
}
apiServerIPs := append(k8s.APIServerIPs,
apiServerIPs := k8s.APIServerIPs
apiServerIPs = append(apiServerIPs,
net.ParseIP(n.IP), serviceIP, net.ParseIP(oci.DefaultBindIPV4), net.ParseIP("10.0.0.1"))
apiServerNames := append(k8s.APIServerNames, k8s.APIServerName, constants.ControlPlaneAlias)
apiServerAlternateNames := append(
apiServerNames,
apiServerNames := k8s.APIServerNames
apiServerNames = append(apiServerNames, k8s.APIServerName, constants.ControlPlaneAlias)
apiServerAlternateNames := apiServerNames
apiServerAlternateNames = append(apiServerAlternateNames,
util.GetAlternateDNS(k8s.DNSDomain)...)
daemonHost := oci.DaemonHost(k8s.ContainerRuntime)

View File

@ -222,7 +222,7 @@ func TestExcludeIP(t *testing.T) {
func TestUpdateTransport(t *testing.T) {
t.Run("new", func(t *testing.T) {
rc := rest.Config{}
c := UpdateTransport(&rc)
UpdateTransport(&rc)
tr := &http.Transport{}
tr.RegisterProtocol("file", http.NewFileTransport(http.Dir("/tmp")))
})

View File

@ -30,7 +30,8 @@ type testCase struct {
}
func appendVersionVariations(tc []testCase, v []int, reason string) []testCase {
appendedTc := append(tc, testCase{
appendedTc := tc
appendedTc = append(appendedTc, testCase{
version: fmt.Sprintf("linux-%02d.%02d", v[0], v[1]),
expect: reason,
})

View File

@ -164,7 +164,7 @@ func (router *osRouter) Cleanup(route *Route) error {
if err != nil {
return err
}
msg := fmt.Sprintf("%s", stdInAndOut)
msg := string(stdInAndOut)
klog.V(4).Infof("%s", msg)
re := regexp.MustCompile("^delete net ([^:]*)$")
if !re.MatchString(msg) {