diff --git a/.travis.yml b/.travis.yml index 5731319e99..35606fe902 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,4 +2,14 @@ language: go go: - 1.5.3 - - tip + - 1.6 +# - tip # NOTE: disabled - see https://github.com/travis-ci/gimme/issues/38 + +install: + - go get golang.org/x/tools/cmd/vet + - go get github.com/golang/lint/golint + +script: + - go test -v ./... + - go vet ./... + - GOFMT=$(gofmt -d -s .) && echo $GOFMT && test -z "$GOFMT" diff --git a/docs/appengine/mail/mailgun/mailgun.go b/docs/appengine/mail/mailgun/mailgun.go index 0a863c44cd..96237d5999 100644 --- a/docs/appengine/mail/mailgun/mailgun.go +++ b/docs/appengine/mail/mailgun/mailgun.go @@ -28,7 +28,7 @@ func SendSimpleMessageHandler(w http.ResponseWriter, r *http.Request) { /* To */ "bar@example.com", "YOU@YOUR_DOMAIN_NAME", )) if err != nil { - msg := fmt.Sprintf("Could not send message: %v, ID %d, %+v", err, id, msg) + msg := fmt.Sprintf("Could not send message: %v, ID %v, %+v", err, id, msg) http.Error(w, msg, http.StatusInternalServerError) return } @@ -61,7 +61,7 @@ func SendComplexMessageHandler(w http.ResponseWriter, r *http.Request) { msg, id, err := mg.Send(message) if err != nil { - msg := fmt.Sprintf("Could not send message: %v, ID %d, %+v", err, id, msg) + msg := fmt.Sprintf("Could not send message: %v, ID %v, %+v", err, id, msg) http.Error(w, msg, http.StatusInternalServerError) return } diff --git a/docs/managed_vms/analytics/analytics.go b/docs/managed_vms/analytics/analytics.go index 7ff076505d..2acb358dd1 100644 --- a/docs/managed_vms/analytics/analytics.go +++ b/docs/managed_vms/analytics/analytics.go @@ -40,10 +40,10 @@ func handle(w http.ResponseWriter, r *http.Request) { func trackEvent(r *http.Request, category, action, label string, value *uint) error { if gaPropertyID == "" { - return errors.New("analytics: GA_TRACKING_ID environment variable.") + return errors.New("analytics: GA_TRACKING_ID environment variable is missing") } if category == "" || action == "" { - return errors.New("analytics: category and action are required.") + return errors.New("analytics: category and action are required") } v := url.Values{ diff --git a/docs/managed_vms/mailgun/mailgun.go b/docs/managed_vms/mailgun/mailgun.go index 0e4071535a..c991c4422a 100644 --- a/docs/managed_vms/mailgun/mailgun.go +++ b/docs/managed_vms/mailgun/mailgun.go @@ -56,7 +56,7 @@ func sendSimpleMessageHandler(w http.ResponseWriter, r *http.Request) { /* To */ "bar@example.com", "YOU@"+mailgunDomain, )) if err != nil { - msg := fmt.Sprintf("Could not send message: %v, ID %d, %+v", err, id, msg) + msg := fmt.Sprintf("Could not send message: %v, ID %v, %+v", err, id, msg) http.Error(w, msg, http.StatusInternalServerError) return } @@ -79,7 +79,7 @@ func sendComplexMessageHandler(w http.ResponseWriter, r *http.Request) { msg, id, err := mailgunClient.Send(message) if err != nil { - msg := fmt.Sprintf("Could not send message: %v, ID %d, %+v", err, id, msg) + msg := fmt.Sprintf("Could not send message: %v, ID %v, %+v", err, id, msg) http.Error(w, msg, http.StatusInternalServerError) return } diff --git a/getting-started/bookshelf/db_memory.go b/getting-started/bookshelf/db_memory.go index bb703f40bd..be0c7e68bc 100644 --- a/getting-started/bookshelf/db_memory.go +++ b/getting-started/bookshelf/db_memory.go @@ -71,7 +71,7 @@ func (db *memoryDB) DeleteBook(id int64) error { defer db.mu.Unlock() if _, ok := db.books[id]; !ok { - return fmt.Errorf("memorydb: could not delete book with ID %d, does not exist.", id) + return fmt.Errorf("memorydb: could not delete book with ID %d, does not exist", id) } delete(db.books, id) return nil @@ -103,7 +103,7 @@ func (db *memoryDB) ListBooks() ([]*Book, error) { db.mu.Lock() defer db.mu.Unlock() - books := make([]*Book, 0) + var books []*Book for _, b := range db.books { books = append(books, b) } diff --git a/getting-started/bookshelf/db_mysql.go b/getting-started/bookshelf/db_mysql.go index 9bb29e54cf..3fb4e33e83 100644 --- a/getting-started/bookshelf/db_mysql.go +++ b/getting-started/bookshelf/db_mysql.go @@ -163,7 +163,7 @@ func (db *mysqlDB) ListBooks() ([]*Book, error) { } defer rows.Close() - books := make([]*Book, 0) + var books []*Book for rows.Next() { book, err := scanBook(rows) if err != nil { @@ -193,7 +193,7 @@ func (db *mysqlDB) ListBooksCreatedBy(userID string) ([]*Book, error) { } defer rows.Close() - books := make([]*Book, 0) + var books []*Book for rows.Next() { book, err := scanBook(rows) if err != nil {