protokube/pkg - fix static check

This commit is contained in:
Ciprian Hacman 2019-12-20 16:18:09 +02:00
parent 4621df3c0a
commit defcbe8151
5 changed files with 7 additions and 56 deletions

View File

@ -17,9 +17,6 @@ pkg/resources/digitalocean/dns
pkg/resources/gce
pkg/resources/openstack
pkg/sshcredentials
protokube/pkg/gossip/dns/hosts
protokube/pkg/gossip/mesh
protokube/pkg/protokube
upup/pkg/fi
upup/pkg/fi/assettasks
upup/pkg/fi/cloudup

View File

@ -22,7 +22,6 @@ import (
"io/ioutil"
math_rand "math/rand"
"os"
"path/filepath"
"sort"
"strings"
"sync"
@ -158,50 +157,3 @@ func pseudoAtomicWrite(p string, b []byte, mode os.FileMode) error {
klog.Warningf("detected concurrent write to file %q, will retry", p)
}
}
func atomicWriteFile(filename string, data []byte, perm os.FileMode) error {
dir := filepath.Dir(filename)
tempFile, err := ioutil.TempFile(dir, ".tmp"+filepath.Base(filename))
if err != nil {
return fmt.Errorf("error creating temp file in %q: %v", dir, err)
}
mustClose := true
mustRemove := true
defer func() {
if mustClose {
if err := tempFile.Close(); err != nil {
klog.Warningf("error closing temp file: %v", err)
}
}
if mustRemove {
if err := os.Remove(tempFile.Name()); err != nil {
klog.Warningf("error removing temp file %q: %v", tempFile.Name(), err)
}
}
}()
if _, err := tempFile.Write(data); err != nil {
return fmt.Errorf("error writing temp file: %v", err)
}
if err := tempFile.Close(); err != nil {
return fmt.Errorf("error closing temp file: %v", err)
}
mustClose = false
if err := os.Chmod(tempFile.Name(), perm); err != nil {
return fmt.Errorf("error changing mode of temp file: %v", err)
}
if err := os.Rename(tempFile.Name(), filename); err != nil {
return fmt.Errorf("error moving temp file %q to %q: %v", tempFile.Name(), filename, err)
}
mustRemove = false
return nil
}

View File

@ -40,7 +40,7 @@ type MeshGossiper struct {
router *mesh.Router
peer *peer
version uint64
//version uint64
}
func NewMeshGossiper(listen string, channelName string, nodeName string, password []byte, seeds gossip.SeedProvider) (*MeshGossiper, error) {

View File

@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
//lint:file-ignore U1000 - Generated code
// Code generated by protoc-gen-gogo.
// source: k8s.io/kops/protokube/pkg/gossip/mesh/mesh.proto
// DO NOT EDIT!

View File

@ -95,10 +95,10 @@ type EtcdNode struct {
// EtcdController defines the etcd controller
type EtcdController struct {
kubeBoot *KubeBoot
volume *Volume
volumeSpec *etcd.EtcdClusterSpec
cluster *EtcdCluster
kubeBoot *KubeBoot
//volume *Volume
//volumeSpec *etcd.EtcdClusterSpec
cluster *EtcdCluster
}
// newEtcdController creates and returns a new etcd controller