Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
go vet + golint 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
errm committed Jun 15, 2018
1 parent 033eaae commit 922b95b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func main() {
systemdDbus, err := dbus.New()
check(err)

systemd := &system.Systemd{systemdDbus}
systemd := &system.Systemd{Conn: systemdDbus}

system := system.System{
Filesystem: &file.Atomic{},
Expand Down
2 changes: 1 addition & 1 deletion pkg/backoff/backoff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestEmptyBackoff(t *testing.T) {
}

func TestJitteredBackoff(t *testing.T) {
seq := backoff.Backoff{[]int{1, 2, 4, 8}}
seq := backoff.Backoff{Seq: []int{1, 2, 4, 8}}

if seq.Duration(1) == seq.Duration(1) {
t.Error("Jitter should ensure calls are not equal")
Expand Down
2 changes: 1 addition & 1 deletion pkg/eks/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/aws/aws-sdk-go/service/eks/eksiface"
)

var b = backoff.Backoff{[]int{1, 2, 4, 8, 16, 32, 64}}
var b = backoff.Backoff{Seq: []int{1, 2, 4, 8, 16, 32, 64}}

// Cluster returns the named EKS cluster.
//
Expand Down
1 change: 1 addition & 0 deletions pkg/file/atomic.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"syscall"
)

//Atomic exposes an interface to atomicly write config files to the filesystem
type Atomic struct{}

// Sync atomicly writes data to a file at the given path with the given permissions
Expand Down
18 changes: 11 additions & 7 deletions pkg/system/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,28 @@ import (
"text/template"
)

type Filesystem interface {
type filesystem interface {
Sync(io.Reader, string, os.FileMode) error
}

type Init interface {
type initsystem interface {
EnsureRunning(string) error
}

type Hostname interface {
type hostname interface {
SetHostname(string) error
}

// System represents the system we are configuring and
// should be created with the interfaces to interact with it
type System struct {
Filesystem Filesystem
Init Init
Hostname Hostname
Filesystem filesystem
Init initsystem
Hostname hostname
}

// Configure configures the system to connect to the EKS cluster given the node
// and cluster metadata provided as arguments
func (s System) Configure(n *node.Node, cluster *eks.Cluster) error {
if err := s.Hostname.SetHostname(*n.PrivateDnsName); err != nil {
return err
Expand Down Expand Up @@ -81,7 +85,7 @@ func base64decode(v string) (string, error) {
type config struct {
template *template.Template
path string
filesystem Filesystem
filesystem filesystem
}

func (c config) write(data interface{}) error {
Expand Down
4 changes: 2 additions & 2 deletions pkg/system/systemd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestEnsureRunning(t *testing.T) {
for _, tC := range testCases {
t.Run(tC.desc, func(t *testing.T) {
d := &fakeDbusConn{}
s := &system.Systemd{d}
s := &system.Systemd{Conn: d}

err := s.EnsureRunning(tC.unit)
if err != nil {
Expand Down Expand Up @@ -105,7 +105,7 @@ func TestErrorHandling(t *testing.T) {
errs := make(map[string]error)
errs[tC.name] = tC.err
d := &fakeDbusConn{errors: errs}
s := &system.Systemd{d}
s := &system.Systemd{Conn: d}
err := s.EnsureRunning("kubelet.service")
if err != tC.err {
t.Errorf("Got error: %v, expected %v", err, tC.err)
Expand Down

0 comments on commit 922b95b

Please sign in to comment.