Skip to content

Commit 463936d

Browse files
committed
Golint fixes
1 parent 5010b11 commit 463936d

File tree

12 files changed

+24
-8
lines changed

12 files changed

+24
-8
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,8 @@ travis_install:
8585

8686
travis_run: build
8787
go test -v -covermode=count -coverprofile=profile.cov
88+
89+
90+
golint:
91+
@go get github.com/golang/lint/golint
92+
@for dir in */; do golint $$dir; done

api/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ type ScalewayImageDefinition struct {
452452
Arch string `json:"arch"`
453453
}
454454

455+
// FuncMap used for json inspection
455456
var FuncMap = template.FuncMap{
456457
"json": func(v interface{}) string {
457458
a, _ := json.Marshal(v)

api/helpers.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ func InspectIdentifiers(api *ScalewayAPI, ci chan ScalewayResolvedIdentifier, cj
199199
close(cj)
200200
}
201201

202+
// CreateServer creates a server using API based on typical server fields
202203
func CreateServer(api *ScalewayAPI, imageName string, name string, bootscript string, env string, additionalVolumes string) (string, error) {
203204
if name == "" {
204205
name = strings.Replace(namesgenerator.GetRandomName(0), "_", "-", -1)
@@ -295,6 +296,7 @@ func (a ByCreationDate) Len() int { return len(a) }
295296
func (a ByCreationDate) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
296297
func (a ByCreationDate) Less(i, j int) bool { return a[j].CreationDate.Before(a[i].CreationDate) }
297298

299+
// StartServer start a server based on its needle, can optionaly block while server is booting
298300
func StartServer(api *ScalewayAPI, needle string, wait bool) error {
299301
server := api.GetServerID(needle)
300302

@@ -314,6 +316,7 @@ func StartServer(api *ScalewayAPI, needle string, wait bool) error {
314316
return nil
315317
}
316318

319+
// StartServerOnce wraps StartServer for golang channel
317320
func StartServerOnce(api *ScalewayAPI, needle string, wait bool, successChan chan bool, errChan chan error) {
318321
err := StartServer(api, needle, wait)
319322

commands/commands.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package commands
22

33
import types "github.com/scaleway/scaleway-cli/commands/types"
44

5+
// Commands is the list of enabled CLI commands
56
var Commands = []*types.Command{
67
CmdHelp,
78

commands/cp.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func init() {
4444
// Flags
4545
var cpHelp bool // -h, --help flag
4646

47+
// TarFromSource creates a stream buffer with the tarballed content of the user source
4748
func TarFromSource(api *api.ScalewayAPI, source string) (*io.ReadCloser, error) {
4849
var tarOutputStream io.ReadCloser
4950

@@ -132,6 +133,7 @@ func TarFromSource(api *api.ScalewayAPI, source string) (*io.ReadCloser, error)
132133
return &tarOutputStream, nil
133134
}
134135

136+
// UntarToDest writes to user destination the streamed tarball in input
135137
func UntarToDest(api *api.ScalewayAPI, sourceStream *io.ReadCloser, destination string) error {
136138
// destination is a server address + path (scp-like uri)
137139
if strings.Index(destination, ":") > -1 {

commands/exec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func runExec(cmd *types.Command, args []string) {
7272
}()
7373
}
7474

75-
err = utils.SshExec(server.PublicAddress.IP, args[1:], !execW)
75+
err = utils.SSHExec(server.PublicAddress.IP, args[1:], !execW)
7676
if err != nil {
7777
log.Fatalf("%v", err)
7878
os.Exit(1)

commands/help.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
types "github.com/scaleway/scaleway-cli/commands/types"
99
)
1010

11+
// CmdHelp is the 'scw help' command
1112
var CmdHelp = &types.Command{
1213
Exec: nil,
1314
UsageLine: "help [COMMAND]",

commands/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func runLogs(cmd *types.Command, args []string) {
3838
// FIXME: switch to serial history when API is ready
3939

4040
command := []string{"dmesg"}
41-
err = utils.SshExec(server.PublicAddress.IP, command, true)
41+
err = utils.SSHExec(server.PublicAddress.IP, command, true)
4242
if err != nil {
4343
log.Fatalf("Command execution failed: %v", err)
4444
}

commands/port.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func runPort(cmd *types.Command, args []string) {
3636
}
3737

3838
command := []string{"netstat -lutn 2>/dev/null | grep LISTEN"}
39-
err = utils.SshExec(server.PublicAddress.IP, command, true)
39+
err = utils.SSHExec(server.PublicAddress.IP, command, true)
4040
if err != nil {
4141
log.Fatalf("Command execution failed: %v", err)
4242
}

commands/run.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ func runRun(cmd *types.Command, args []string) {
7575
// exec -w SERVER COMMAND ARGS...
7676
log.Debugf("Executing command")
7777
if len(args) < 2 {
78-
err = utils.SshExec(server.PublicAddress.IP, []string{"if [ -x /bin/bash ]; then /bin/bash; else /bin/sh; fi"}, false)
78+
err = utils.SSHExec(server.PublicAddress.IP, []string{"if [ -x /bin/bash ]; then /bin/bash; else /bin/sh; fi"}, false)
7979
} else {
80-
err = utils.SshExec(server.PublicAddress.IP, args[1:], false)
80+
err = utils.SSHExec(server.PublicAddress.IP, args[1:], false)
8181
}
8282
if err != nil {
8383
log.Debugf("Command execution failed: %v", err)

0 commit comments

Comments
 (0)