Commit f8c529a7 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

go-vet friendly codebase

- distinguish log.Error and log.Errorf functions
- Initialize structs with field names
- A bit of unreachable code (defers)
parent 2cc804ec
......@@ -26,10 +26,10 @@ func TestOptionParsing(t *testing.T) {
t.Error("Should have passed")
}
if len(opts) != 4 || opts["beep"] != "" || opts["boop"] != "lol" || opts["c"] != "" || opts["foo"] != "5" {
t.Error("Returned options were defferent than expected: %v", opts)
t.Errorf("Returned options were defferent than expected: %v", opts)
}
if len(input) != 2 || input[0] != "test2" || input[1] != "beep" {
t.Error("Returned input was different than expected: %v", input)
t.Errorf("Returned input was different than expected: %v", input)
}
_, _, err = parseOptions([]string{"-beep=1", "-boop=2", "-beep=3"})
......@@ -39,9 +39,9 @@ func TestOptionParsing(t *testing.T) {
path, args := parsePath([]string{"test", "beep", "boop"}, cmd)
if len(path) != 1 || path[0] != "test" {
t.Error("Returned path was defferent than expected: %v", path)
t.Errorf("Returned path was defferent than expected: %v", path)
}
if len(args) != 2 || args[0] != "beep" || args[1] != "boop" {
t.Error("Returned args were different than expected: %v", args)
t.Errorf("Returned args were different than expected: %v", args)
}
}
......@@ -73,8 +73,8 @@ func TestOptionValidation(t *testing.T) {
req = NewEmptyRequest()
req.SetOption("b", ":)")
res = cmd.Call(req)
if res.Error == nil {
t.Error(res.Error, "Should have failed (string value not convertible to int)")
if res.Error() == nil {
t.Error(res.Error(), "Should have failed (string value not convertible to int)")
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment