From e95b75409ad28c0686db1bbc3d6baa2dfab3f4c3 Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Sat, 3 Jul 2021 04:24:58 -0700 Subject: [PATCH] Fix lint failures Signed-off-by: Brad Davidson --- pkg/agent/loadbalancer/config.go | 5 +---- pkg/daemons/control/deps/deps.go | 6 +----- pkg/etcd/etcd.go | 8 ++------ pkg/server/context.go | 4 ++-- pkg/servicelb/controller.go | 4 ++-- 5 files changed, 8 insertions(+), 19 deletions(-) diff --git a/pkg/agent/loadbalancer/config.go b/pkg/agent/loadbalancer/config.go index 9c3ce95098..defeb70bd9 100644 --- a/pkg/agent/loadbalancer/config.go +++ b/pkg/agent/loadbalancer/config.go @@ -12,10 +12,7 @@ func (lb *LoadBalancer) writeConfig() error { if err != nil { return err } - if err := util.WriteFile(lb.configFile, string(configOut)); err != nil { - return err - } - return nil + return util.WriteFile(lb.configFile, string(configOut)) } func (lb *LoadBalancer) updateConfig() error { diff --git a/pkg/daemons/control/deps/deps.go b/pkg/daemons/control/deps/deps.go index acd385c88b..16fc75f3f2 100644 --- a/pkg/daemons/control/deps/deps.go +++ b/pkg/daemons/control/deps/deps.go @@ -247,11 +247,7 @@ func genEncryptedNetworkInfo(controlConfig *config.Control, runtime *config.Cont } controlConfig.IPSECPSK = psk - if err := ioutil.WriteFile(runtime.IPSECKey, []byte(psk+"\n"), 0600); err != nil { - return err - } - - return nil + return ioutil.WriteFile(runtime.IPSECKey, []byte(psk+"\n"), 0600) } func getServerPass(passwd *passwd.Passwd, config *config.Control) (string, error) { diff --git a/pkg/etcd/etcd.go b/pkg/etcd/etcd.go index 06a8909877..f1084232dc 100644 --- a/pkg/etcd/etcd.go +++ b/pkg/etcd/etcd.go @@ -1210,18 +1210,14 @@ func (e *ETCD) Restore(ctx context.Context) error { return err } logrus.Infof("Pre-restore etcd database moved to %s", oldDataDir) - sManager := snapshot.NewV3(nil) - if err := sManager.Restore(snapshot.RestoreConfig{ + return snapshot.NewV3(nil).Restore(snapshot.RestoreConfig{ SnapshotPath: e.config.ClusterResetRestorePath, Name: e.name, OutputDataDir: etcdDBDir(e.config), OutputWALDir: walDir(e.config), PeerURLs: []string{e.peerURL()}, InitialCluster: e.name + "=" + e.peerURL(), - }); err != nil { - return err - } - return nil + }) } // snapshotRetention iterates through the snapshots and removes the oldest diff --git a/pkg/server/context.go b/pkg/server/context.go index ca776d6a1d..2c1fa9fcbb 100644 --- a/pkg/server/context.go +++ b/pkg/server/context.go @@ -11,12 +11,12 @@ import ( "github.com/rancher/k3s/pkg/deploy" "github.com/rancher/k3s/pkg/generated/controllers/k3s.cattle.io" "github.com/rancher/k3s/pkg/version" + "github.com/rancher/wrangler/pkg/apply" + "github.com/rancher/wrangler/pkg/crd" "github.com/rancher/wrangler/pkg/generated/controllers/apps" "github.com/rancher/wrangler/pkg/generated/controllers/batch" "github.com/rancher/wrangler/pkg/generated/controllers/core" "github.com/rancher/wrangler/pkg/generated/controllers/rbac" - "github.com/rancher/wrangler/pkg/apply" - "github.com/rancher/wrangler/pkg/crd" "github.com/rancher/wrangler/pkg/start" "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/apis/meta/v1/validation" diff --git a/pkg/servicelb/controller.go b/pkg/servicelb/controller.go index cf9a3e5ac0..f1c246aeed 100644 --- a/pkg/servicelb/controller.go +++ b/pkg/servicelb/controller.go @@ -7,10 +7,10 @@ import ( "strconv" "github.com/rancher/k3s/pkg/version" - appclient "github.com/rancher/wrangler/pkg/generated/controllers/apps/v1" - coreclient "github.com/rancher/wrangler/pkg/generated/controllers/core/v1" "github.com/rancher/wrangler/pkg/apply" "github.com/rancher/wrangler/pkg/condition" + appclient "github.com/rancher/wrangler/pkg/generated/controllers/apps/v1" + coreclient "github.com/rancher/wrangler/pkg/generated/controllers/core/v1" "github.com/rancher/wrangler/pkg/objectset" "github.com/rancher/wrangler/pkg/relatedresource" "github.com/rancher/wrangler/pkg/slice"