Skip to content

Commit

Permalink
Fix issues flagged by 'go vet'
Browse files Browse the repository at this point in the history
  • Loading branch information
dgryski committed Jul 13, 2016
1 parent 67ff7da commit e65048e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/neurosky.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func main() {
fmt.Println("HiBeta", eeg.HiBeta)
fmt.Println("LoGamma", eeg.LoGamma)
fmt.Println("MidGamma", eeg.MidGamma)
fmt.Println("\n")
fmt.Printf("\n\n")
})
}

Expand Down
2 changes: 1 addition & 1 deletion examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func ExampleOnce() {

func ExampleRand() {
i := gobot.Rand(100)
fmt.Sprintln("%v is > 0 && < 100", i)
fmt.Printf("%v is > 0 && < 100", i)
}

func ExampleFromScale() {
Expand Down
3 changes: 1 addition & 2 deletions platforms/mavlink/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package mavlink
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
)

Expand Down Expand Up @@ -136,7 +135,7 @@ func NewMAVLinkMessage(msgid uint8, data []byte) (MAVLinkMessage, error) {
message.Decode(data)
return message, nil
}
return nil, errors.New(fmt.Sprintf("Unknown Message ID: %v", msgid))
return nil, fmt.Errorf("Unknown Message ID: %v", msgid)
}

//
Expand Down
2 changes: 1 addition & 1 deletion platforms/spark/spark_core_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func (s *SparkCoreAdaptor) requestToSpark(method string, url string, params url.
json.Unmarshal(buf, &m)

if resp.Status != "200 OK" {
err = errors.New(fmt.Sprintf("&v: error communicating to the spark cloud", resp.Status))
err = fmt.Errorf("%v: error communicating to the spark cloud", resp.Status)
} else if _, ok := m["error"]; ok {
err = errors.New(m["error"].(string))
}
Expand Down
4 changes: 2 additions & 2 deletions platforms/spark/spark_core_adaptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func TestSparkCoreAdaptorPostToSpark(t *testing.T) {
vals.Add("error", "error")
resp, err := a.requestToSpark("POST", "http://invalid%20host.com", vals)
if err == nil {
t.Errorf("requestToSpark() should return an error when request was unsuccessful but returned", resp)
t.Error("requestToSpark() should return an error when request was unsuccessful but returned", resp)
}

// When error reading body
Expand All @@ -339,7 +339,7 @@ func TestSparkCoreAdaptorPostToSpark(t *testing.T) {

resp, err = a.requestToSpark("POST", testServer.URL+"/existent", vals)
if err == nil {
t.Errorf("requestToSpark() should return an error when status is not 200 but returned", resp)
t.Error("requestToSpark() should return an error when status is not 200 but returned", resp)
}

}
Expand Down

0 comments on commit e65048e

Please sign in to comment.