Merge pull request #296 from dgryski/go-vet

Fix issues flagged by 'go vet'
This commit is contained in:
Ron Evans 2016-07-13 12:18:28 -06:00 committed by GitHub
commit a112eb975a
5 changed files with 6 additions and 7 deletions

View File

@ -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")
})
}

View File

@ -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() {

View File

@ -7,7 +7,6 @@ package mavlink
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
)
@ -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)
}
//

View File

@ -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))
}

View File

@ -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
@ -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)
}
}