Skip to content

Commit

Permalink
Cleanup golint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ernoaapa committed Feb 8, 2018
1 parent ae8186c commit fa5e461
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 26 deletions.
5 changes: 1 addition & 4 deletions cmd/eli/createPodCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ var createPodCommand = cli.Command{
defer writer.Flush()
printer := cmd.GetPrinter(clicontext)

if err := printer.PrintPod(result, writer); err != nil {
return err
}
return nil
return printer.PrintPod(result, writer)
},
}
1 change: 1 addition & 0 deletions pkg/cmd/ui/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func NewDebug() *Debug {
return debug
}

// Start starts updating the terminal lines
func (t *Debug) Start() {
t.running = true
}
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/ui/line.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ui

// Line represents single ine in terminal output
type Line interface {
WithProgress(current, total int64) Line
Infof(format string, args ...interface{}) Line
Expand Down
5 changes: 3 additions & 2 deletions pkg/cmd/ui/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Terminal struct {
}

// NewTerminal creates new Terminal UI which prints
// output to the
// output to the os.Stdout
func NewTerminal() *Terminal {
terminal := &Terminal{
writer: goterminal.New(os.Stdout),
Expand All @@ -29,6 +29,7 @@ func NewTerminal() *Terminal {
return terminal
}

// Start starts updating the terminal lines
func (t *Terminal) Start() {
t.running = true
go func() {
Expand Down Expand Up @@ -68,7 +69,7 @@ func (t *Terminal) NewLine() Line {
t.mtx.Lock()
defer t.mtx.Unlock()

row := &TerminalLine{updater: t}
row := &TerminalLine{terminal: t}
t.rows = append(t.rows, row)
return row
}
1 change: 1 addition & 0 deletions pkg/cmd/ui/terminal/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
)

// Bar presents progress bar
type Bar struct {
// Fill is the default character representing completed progress
Fill byte
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/ui/terminal/spinner.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package terminal

import "github.com/ernoaapa/eliot/pkg/utils"

// Spinner is loading spinner which on each rotation moves spinner around
type Spinner struct {
frames []string
}
Expand Down
8 changes: 2 additions & 6 deletions pkg/cmd/ui/terminalline.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import (
"github.com/willf/pad"
)

type Updater interface {
Update()
}

// State of the line
type State int

Expand All @@ -31,7 +27,7 @@ const (

// TerminalLine is single text line in the terminal output what you can change afterward
type TerminalLine struct {
updater Updater
terminal *Terminal
state State
Text string
showProgress bool
Expand Down Expand Up @@ -155,5 +151,5 @@ func (r *TerminalLine) render() string {

// Update triggers re-rendering
func (r *TerminalLine) Update() {
r.updater.Update()
r.terminal.Update()
}
1 change: 1 addition & 0 deletions pkg/discovery/mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/grandcat/zeroconf"
)

// MapToInternalModel takes zeroconf entry and maps it to internal DeviceInfo model
func MapToInternalModel(entry *zeroconf.ServiceEntry) model.DeviceInfo {
version := "unknown"

Expand Down
16 changes: 3 additions & 13 deletions pkg/printers/humanreadable.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,7 @@ func (p *HumanReadablePrinter) PrintDevice(info *device.Info, writer io.Writer)
if err != nil {
log.Fatalf("Invalid pod template: %s", err)
}
if err := t.Execute(writer, info); err != nil {
return err
}
return nil
return t.Execute(writer, info)
}

// PrintPod writes a pod in human readable detailed format to the writer
Expand All @@ -133,10 +130,7 @@ func (p *HumanReadablePrinter) PrintPod(pod *pods.Pod, writer io.Writer) error {
"Pod": pod,
"Status": getStatus(pod),
}
if err := t.Execute(writer, data); err != nil {
return err
}
return nil
return t.Execute(writer, data)
}

// PrintConfig writes list of pods in human readable detailed format to the writer
Expand All @@ -147,9 +141,5 @@ func (p *HumanReadablePrinter) PrintConfig(config *config.Config, writer io.Writ
log.Fatalf("Invalid config template: %s", err)
}

if err := t.Execute(writer, config); err != nil {
return err
}

return nil
return t.Execute(writer, config)
}
1 change: 1 addition & 0 deletions pkg/sync/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"
)

// MustParseAll parse sync string or fail with Fatal
func MustParseAll(strings []string) (result []Sync) {
for _, str := range strings {
sync, err := Parse(str)
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/lists.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func RotateL(a *[]string) {
RotateLBy(a, 1)
}

// RotateL rotates the string array to left by given steps
// RotateLBy rotates the string array to left by given steps
func RotateLBy(a *[]string, i int) {
x, b := (*a)[:i], (*a)[i:]
*a = append(b, x...)
Expand Down

0 comments on commit fa5e461

Please sign in to comment.