Skip to content

Commit 19973f2

Browse files
Fix golint errors
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
1 parent 32185d4 commit 19973f2

File tree

24 files changed

+40
-41
lines changed

24 files changed

+40
-41
lines changed

commands/commands.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ const (
2323
)
2424

2525
var (
26-
ErrHostLoad = errors.New("All specified hosts had errors loading their configuration.")
27-
ErrNoDefault = fmt.Errorf("Error: No machine name(s) specified and no %q machine exists.", defaultMachineName)
26+
ErrHostLoad = errors.New("All specified hosts had errors loading their configuration")
27+
ErrNoDefault = fmt.Errorf("Error: No machine name(s) specified and no %q machine exists", defaultMachineName)
2828
ErrNoMachineSpecified = errors.New("Error: Expected to get one or more machine names as arguments")
2929
ErrExpectedOneMachine = errors.New("Error: Expected one machine name as an argument")
3030
ErrTooManyArguments = errors.New("Error: Too many arguments given")

commands/inspect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func cmdInspect(c CommandLine, api libmachine.API) error {
4141
var tmpl *template.Template
4242
var err error
4343
if tmpl, err = template.New("").Funcs(funcMap).Parse(tmplString); err != nil {
44-
return fmt.Errorf("Template parsing error: %v\n", err)
44+
return fmt.Errorf("template parsing error: %v", err)
4545
}
4646

4747
jsonHost, err := json.Marshal(host)

commands/ls.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func parseFilters(filters []string) (FilterOptions, error) {
181181
for _, f := range filters {
182182
kv := strings.SplitN(f, "=", 2)
183183
if len(kv) != 2 {
184-
return options, errors.New("Unsupported filter syntax.")
184+
return options, errors.New("Unsupported filter syntax")
185185
}
186186
key, value := strings.ToLower(kv[0]), kv[1]
187187

@@ -468,7 +468,7 @@ func newHostListItemInError(name string, err error) HostListItem {
468468
Name: name,
469469
DriverName: "not found",
470470
State: state.Error,
471-
Error: strings.Replace(err.Error(), "\n", " ", -1),
471+
Error: strings.Replace(err.Error(), "\n", "", -1),
472472
}
473473
}
474474

commands/ls_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,9 @@ func TestGetSomeHostInError(t *testing.T) {
527527
}
528528

529529
func TestOnErrorWithMultilineComment(t *testing.T) {
530-
err := errors.New("MissingParameter: The request must contain the parameter InstanceId\n status code: 400, request id:")
530+
err := errors.New("missing parameter: the request must contain the parameter InstanceId\n status code: 400")
531531

532532
itemInError := newHostListItemInError("foo", err)
533533

534-
assert.Equal(t, itemInError.Error, "MissingParameter: The request must contain the parameter InstanceId status code: 400, request id:")
534+
assert.Equal(t, itemInError.Error, "missing parameter: the request must contain the parameter InstanceId status code: 400")
535535
}

commands/scp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func cmdScp(c CommandLine, api libmachine.API) error {
7777
func getScpCmd(src, dest string, recursive bool, hostInfoLoader HostInfoLoader) (*exec.Cmd, error) {
7878
cmdPath, err := exec.LookPath("scp")
7979
if err != nil {
80-
return nil, errors.New("Error: You must have a copy of the scp binary locally to use the scp feature.")
80+
return nil, errors.New("You must have a copy of the scp binary locally to use the scp feature")
8181
}
8282

8383
srcHost, srcPath, srcOpts, err := getInfoForScpArg(src, hostInfoLoader)

drivers/azure/azure.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,9 @@ func (d *Driver) Kill() error {
562562
func (d *Driver) checkLegacyDriver(short bool) error {
563563
if d.ResourceGroup == "" {
564564
if short {
565-
return errors.New("New azure driver cannot manage old VMs, downgrade to v0.6.0")
565+
return errors.New("new azure driver cannot manage old VMs, downgrade to v0.6.0")
566566
}
567-
return errors.New("New azure driver uses the new Azure Resource Manager APIs and therefore cannot manage this existing machine created with old azure driver. Please downgrade to docker-machine 0.6.0 to continue using these machines or to remove them.")
567+
return errors.New("new azure driver uses the new Azure Resource Manager APIs and therefore cannot manage this existing machine created with old azure driver. Please downgrade to docker-machine 0.6.0 to continue using these machines or to remove them")
568568
}
569569
return nil
570570
}

drivers/azure/azureutil/azureutil.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (a AzureClient) RegisterResourceProviders(namespaces ...string) error {
6161
return err
6262
}
6363
if l.Value == nil {
64-
return errors.New("Resource Providers list is returned as nil.")
64+
return errors.New("resource providers list is returned as nil")
6565
}
6666

6767
m := make(map[string]bool)
@@ -72,7 +72,7 @@ func (a AzureClient) RegisterResourceProviders(namespaces ...string) error {
7272
for _, ns := range namespaces {
7373
registered, ok := m[strings.ToLower(ns)]
7474
if !ok {
75-
return fmt.Errorf("Unknown resource provider %q", ns)
75+
return fmt.Errorf("unknown resource provider %q", ns)
7676
}
7777
if registered {
7878
log.Debugf("Already registered for %q", ns)

drivers/azure/azureutil/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type imageName struct{ publisher, offer, sku, version string }
3737
func parseImageName(image string) (imageName, error) {
3838
l := strings.Split(image, ":")
3939
if len(l) != 4 {
40-
return imageName{}, fmt.Errorf("Image name %q not a valid format.", image)
40+
return imageName{}, fmt.Errorf("image name %q not a valid format", image)
4141
}
4242
return imageName{l[0], l[1], l[2], l[3]}, nil
4343
}

drivers/exoscale/exoscale.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package exoscale
22

33
import (
4+
"errors"
45
"fmt"
56
"io/ioutil"
67
"net"
@@ -166,7 +167,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
166167
d.URL = "https://api.exoscale.ch/compute"
167168
}
168169
if d.APIKey == "" || d.APISecretKey == "" {
169-
return fmt.Errorf("Please specify an API key (--exoscale-api-key) and an API secret key (--exoscale-api-secret-key).")
170+
return errors.New("missing an API key (--exoscale-api-key) or API secret key (--exoscale-api-secret-key)")
170171
}
171172

172173
return nil

drivers/google/google.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package google
22

33
import (
4+
"errors"
45
"fmt"
56
"net"
67
"strings"
@@ -173,7 +174,7 @@ func (d *Driver) DriverName() string {
173174
func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
174175
d.Project = flags.String("google-project")
175176
if d.Project == "" {
176-
return fmt.Errorf("Please specify the Google Cloud Project name using the option --google-project.")
177+
return errors.New("no Google Cloud Project name specified (--google-project)")
177178
}
178179

179180
d.Zone = flags.String("google-zone")
@@ -220,11 +221,11 @@ func (d *Driver) PreCreateCheck() error {
220221
instance, _ := c.instance()
221222
if d.UseExisting {
222223
if instance == nil {
223-
return fmt.Errorf("Unable to find instance %q in zone %q.", d.MachineName, d.Zone)
224+
return fmt.Errorf("unable to find instance %q in zone %q", d.MachineName, d.Zone)
224225
}
225226
} else {
226227
if instance != nil {
227-
return fmt.Errorf("Instance %q already exists in zone %q.", d.MachineName, d.Zone)
228+
return fmt.Errorf("instance %q already exists in zone %q", d.MachineName, d.Zone)
228229
}
229230
}
230231

0 commit comments

Comments
 (0)