diff --git a/bolt/bbolt.go b/bolt/bbolt.go index 6d395666abe..9e3ac69ee46 100644 --- a/bolt/bbolt.go +++ b/bolt/bbolt.go @@ -14,17 +14,6 @@ import ( "go.uber.org/zap" ) -const ( - // ErrUnableToOpen means we had an issue establishing a connection (or creating the database) - ErrUnableToOpen = "Unable to open boltdb; is there a chronograf already running? %v" - // ErrUnableToBackup means we couldn't copy the db file into ./backup - ErrUnableToBackup = "Unable to backup your database prior to migrations: %v" - // ErrUnableToInitialize means we couldn't create missing Buckets (maybe a timeout) - ErrUnableToInitialize = "Unable to boot boltdb: %v" - // ErrUnableToMigrate means we had an issue changing the db schema - ErrUnableToMigrate = "Unable to migrate boltdb: %v" -) - // OpPrefix is the prefix for bolt ops const OpPrefix = "bolt/" @@ -84,7 +73,7 @@ func (c *Client) Open(ctx context.Context) error { // Open database file. db, err := bolt.Open(c.Path, 0600, &bolt.Options{Timeout: 1 * time.Second}) if err != nil { - return fmt.Errorf(ErrUnableToOpen, err) + return fmt.Errorf("unable to open boltdb; is there a chronograf already running? %v", err) } c.db = db diff --git a/bolt/secret.go b/bolt/secret.go index f97adfdc000..83fcbe41c54 100644 --- a/bolt/secret.go +++ b/bolt/secret.go @@ -3,6 +3,7 @@ package bolt import ( "context" "encoding/base64" + "errors" "fmt" bolt "github.com/coreos/bbolt" @@ -161,7 +162,7 @@ func encodeSecretKey(orgID platform.ID, k string) ([]byte, error) { func decodeSecretKey(key []byte) (platform.ID, string, error) { if len(key) < platform.IDLength { // This should not happen. - return platform.InvalidID(), "", fmt.Errorf("Provided key is too short to contain an ID. Please report this error.") + return platform.InvalidID(), "", errors.New("provided key is too short to contain an ID. Please report this error.") } var id platform.ID diff --git a/chronograf/.kapacitor/ast_test.go b/chronograf/.kapacitor/ast_test.go index 66726f63888..fe08f3aa9c9 100644 --- a/chronograf/.kapacitor/ast_test.go +++ b/chronograf/.kapacitor/ast_test.go @@ -1551,16 +1551,16 @@ trigger t.Run(tt.name, func(t *testing.T) { got, err := Reverse(tt.script) if (err != nil) != tt.wantErr { - t.Errorf("Reverse() error = %v, wantErr %v", err, tt.wantErr) + t.Errorf("reverse error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { - t.Errorf("Reverse() = %s", cmp.Diff(got, tt.want)) + t.Errorf("reverse = %s", cmp.Diff(got, tt.want)) if tt.want.Query != nil { if got.Query == nil { - t.Errorf("Reverse() = got nil QueryConfig") + t.Errorf("reverse = got nil QueryConfig") } else if !cmp.Equal(*got.Query, *tt.want.Query) { - t.Errorf("Reverse() = QueryConfig not equal %s", cmp.Diff(*got.Query, *tt.want.Query)) + t.Errorf("reverse = QueryConfig not equal %s", cmp.Diff(*got.Query, *tt.want.Query)) } } } diff --git a/chronograf/.kapacitor/client_test.go b/chronograf/.kapacitor/client_test.go index 796cac279b3..0a20ace88b6 100644 --- a/chronograf/.kapacitor/client_test.go +++ b/chronograf/.kapacitor/client_test.go @@ -8,8 +8,8 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/influxdata/platform/chronograf" client "github.com/influxdata/kapacitor/client/v1" + "github.com/influxdata/platform/chronograf" ) type MockKapa struct { @@ -424,7 +424,7 @@ func TestClient_Get(t *testing.T) { }, taskOptions: nil, wantErr: true, - resError: fmt.Errorf("No such task"), + resError: fmt.Errorf("no such task"), link: client.Link{ Href: "/kapacitor/v1/tasks/myid", }, diff --git a/chronograf/.kapacitor/operators.go b/chronograf/.kapacitor/operators.go index e707558f66a..5b53a1d2038 100644 --- a/chronograf/.kapacitor/operators.go +++ b/chronograf/.kapacitor/operators.go @@ -67,12 +67,12 @@ func rangeOperators(operator string) ([]string, error) { func chronoRangeOperators(ops []string) (string, error) { if len(ops) != 3 { - return "", fmt.Errorf("Unknown operators") + return "", fmt.Errorf("unknown operators") } if ops[0] == ">=" && ops[1] == "AND" && ops[2] == "<=" { return insideRange, nil } else if ops[0] == "<" && ops[1] == "OR" && ops[2] == ">" { return outsideRange, nil } - return "", fmt.Errorf("Unknown operators") + return "", fmt.Errorf("unknown operators") } diff --git a/chronograf/.kapacitor/triggers.go b/chronograf/.kapacitor/triggers.go index d0d27d42d30..141192ab73e 100644 --- a/chronograf/.kapacitor/triggers.go +++ b/chronograf/.kapacitor/triggers.go @@ -105,7 +105,7 @@ func Trigger(rule chronograf.AlertRule) (string, error) { trigger, err = thresholdRangeTrigger(rule) } default: - trigger, err = "", fmt.Errorf("Unknown trigger type: %s", rule.Trigger) + trigger, err = "", fmt.Errorf("unknown trigger type: %s", rule.Trigger) } if err != nil { @@ -137,7 +137,7 @@ func relativeTrigger(rule chronograf.AlertRule) (string, error) { } else if rule.TriggerValues.Change == ChangeAmount { return fmt.Sprintf(RelativeAbsoluteTrigger, op), nil } else { - return "", fmt.Errorf("Unknown change type %s", rule.TriggerValues.Change) + return "", fmt.Errorf("unknown change type %s", rule.TriggerValues.Change) } } diff --git a/chronograf/.kapacitor/vars.go b/chronograf/.kapacitor/vars.go index 22a5d5f60ce..9982f4740cf 100644 --- a/chronograf/.kapacitor/vars.go +++ b/chronograf/.kapacitor/vars.go @@ -72,7 +72,7 @@ func Vars(rule chronograf.AlertRule) (string, error) { "0.0", // deadman threshold hardcoded to zero ), nil default: - return "", fmt.Errorf("Unknown trigger mechanism") + return "", fmt.Errorf("unknown trigger mechanism") } } @@ -207,7 +207,7 @@ func idVar(q *chronograf.QueryConfig) string { func field(q *chronograf.QueryConfig) (string, error) { if q == nil { - return "", fmt.Errorf("No fields set in query") + return "", fmt.Errorf("no fields set in query") } if len(q.Fields) != 1 { return "", fmt.Errorf("expect only one field but found %d", len(q.Fields)) @@ -223,7 +223,7 @@ func field(q *chronograf.QueryConfig) (string, error) { return f, nil } } - return "", fmt.Errorf("No fields set in query") + return "", fmt.Errorf("no fields set in query") } f, ok := field.Value.(string) if !ok { diff --git a/chronograf/bolt/client.go b/chronograf/bolt/client.go index 47807c4770c..62933d7dda0 100644 --- a/chronograf/bolt/client.go +++ b/chronograf/bolt/client.go @@ -13,17 +13,6 @@ import ( "github.com/influxdata/platform/chronograf/id" ) -const ( - // ErrUnableToOpen means we had an issue establishing a connection (or creating the database) - ErrUnableToOpen = "Unable to open boltdb; is there a chronograf already running? %v" - // ErrUnableToBackup means we couldn't copy the db file into ./backup - ErrUnableToBackup = "Unable to backup your database prior to migrations: %v" - // ErrUnableToInitialize means we couldn't create missing Buckets (maybe a timeout) - ErrUnableToInitialize = "Unable to boot boltdb: %v" - // ErrUnableToMigrate means we had an issue changing the db schema - ErrUnableToMigrate = "Unable to migrate boltdb: %v" -) - // Client is a client for the boltDB data store. type Client struct { Path string @@ -104,7 +93,7 @@ func (c *Client) Open(ctx context.Context, logger chronograf.Logger, build chron // Open database file. db, err := bolt.Open(c.Path, 0600, &bolt.Options{Timeout: 1 * time.Second}) if err != nil { - return fmt.Errorf(ErrUnableToOpen, err) + return fmt.Errorf("unable to open boltdb; is there a chronograf already running? %v", err) } c.db = db c.logger = logger @@ -112,17 +101,17 @@ func (c *Client) Open(ctx context.Context, logger chronograf.Logger, build chron for _, opt := range opts { if opt.Backup() { if err = c.backup(ctx, build); err != nil { - return fmt.Errorf(ErrUnableToBackup, err) + return fmt.Errorf("unable to backup your database prior to migrations: %v", err) } } } } if err := c.initialize(ctx); err != nil { - return fmt.Errorf(ErrUnableToInitialize, err) + return fmt.Errorf("unable to boot boltdb: %v", err) } if err := c.migrate(ctx, build); err != nil { - return fmt.Errorf(ErrUnableToMigrate, err) + return fmt.Errorf("unable to migrate boltdb: %v", err) } return nil diff --git a/chronograf/bolt/internal/internal.go b/chronograf/bolt/internal/internal.go index 0ee75c9928b..1fe75098b60 100644 --- a/chronograf/bolt/internal/internal.go +++ b/chronograf/bolt/internal/internal.go @@ -735,7 +735,7 @@ func UnmarshalConfig(data []byte, c *chronograf.Config) error { return err } if pb.Auth == nil { - return fmt.Errorf("Auth config is nil") + return fmt.Errorf("auth config is nil") } c.Auth.SuperAdminNewUsers = pb.Auth.SuperAdminNewUsers @@ -791,7 +791,7 @@ func UnmarshalOrganizationConfig(data []byte, c *chronograf.OrganizationConfig) } if pb.LogViewer == nil { - return fmt.Errorf("Log Viewer config is nil") + return fmt.Errorf("log Viewer config is nil") } c.OrganizationID = pb.OrganizationID diff --git a/chronograf/canned/bin.go b/chronograf/canned/bin.go index 303675cb4b0..8bd3d958bb4 100644 --- a/chronograf/canned/bin.go +++ b/chronograf/canned/bin.go @@ -45,12 +45,12 @@ func (s *BinLayoutsStore) All(ctx context.Context) ([]chronograf.Layout, error) // Add is not support by BinLayoutsStore func (s *BinLayoutsStore) Add(ctx context.Context, layout chronograf.Layout) (chronograf.Layout, error) { - return chronograf.Layout{}, fmt.Errorf("Add to BinLayoutsStore not supported") + return chronograf.Layout{}, fmt.Errorf("add to BinLayoutsStore not supported") } // Delete is not support by BinLayoutsStore func (s *BinLayoutsStore) Delete(ctx context.Context, layout chronograf.Layout) error { - return fmt.Errorf("Delete to BinLayoutsStore not supported") + return fmt.Errorf("delete to BinLayoutsStore not supported") } // Get retrieves Layout if `ID` exists. @@ -79,5 +79,5 @@ func (s *BinLayoutsStore) Get(ctx context.Context, ID string) (chronograf.Layout // Update not supported func (s *BinLayoutsStore) Update(ctx context.Context, layout chronograf.Layout) error { - return fmt.Errorf("Update to BinLayoutsStore not supported") + return fmt.Errorf("update to BinLayoutsStore not supported") } diff --git a/chronograf/docs/slides/mnGo/mux/mux_go b/chronograf/docs/slides/mnGo/mux/mux_go index 151d8d81565..3f151072a24 100644 --- a/chronograf/docs/slides/mnGo/mux/mux_go +++ b/chronograf/docs/slides/mnGo/mux/mux_go @@ -226,7 +226,7 @@ func invalidData(w http.ResponseWriter, err error, logger chronograf.Logger) { } func invalidJSON(w http.ResponseWriter, logger chronograf.Logger) { - Error(w, http.StatusBadRequest, "Unparsable JSON", logger) + Error(w, http.StatusBadRequest, "unparsable JSON", logger) } func unknownErrorWithMessage(w http.ResponseWriter, err error, logger chronograf.Logger) { @@ -242,7 +242,7 @@ func paramID(key string, r *http.Request) (int, error) { param := httprouter.GetParamFromContext(ctx, key) id, err := strconv.Atoi(param) if err != nil { - return -1, fmt.Errorf("Error converting ID %s", param) + return -1, fmt.Errorf("error converting ID %s", param) } return id, nil } diff --git a/chronograf/enterprise/meta.go b/chronograf/enterprise/meta.go index 84fe4ed1334..f079f8c1957 100644 --- a/chronograf/enterprise/meta.go +++ b/chronograf/enterprise/meta.go @@ -147,7 +147,7 @@ func (m *MetaClient) User(ctx context.Context, name string) (*User, error) { for _, user := range users.Users { return &user, nil } - return nil, fmt.Errorf("No user found") + return nil, fmt.Errorf("no user found") } // CreateUser adds a user to Influx Enterprise @@ -279,7 +279,7 @@ func (m *MetaClient) Role(ctx context.Context, name string) (*Role, error) { for _, role := range roles.Roles { return &role, nil } - return nil, fmt.Errorf("No role found") + return nil, fmt.Errorf("no role found") } // CreateRole adds a role to Influx Enterprise diff --git a/chronograf/enterprise/meta_test.go b/chronograf/enterprise/meta_test.go index 1d0f7be146e..3974ba8b556 100644 --- a/chronograf/enterprise/meta_test.go +++ b/chronograf/enterprise/meta_test.go @@ -1338,10 +1338,10 @@ func NewMockClient(code int, body []byte, headers http.Header, err error) *MockC func (c *MockClient) Do(URL *url.URL, path, method string, authorizer influx.Authorizer, params map[string]string, body io.Reader) (*http.Response, error) { if c == nil { - return nil, fmt.Errorf("NIL MockClient") + return nil, fmt.Errorf("nIL MockClient") } if URL == nil { - return nil, fmt.Errorf("NIL url") + return nil, fmt.Errorf("nIL url") } if c.Err != nil { return nil, c.Err diff --git a/chronograf/enterprise/users_test.go b/chronograf/enterprise/users_test.go index ba5be6e7268..9d2f0e8bce2 100644 --- a/chronograf/enterprise/users_test.go +++ b/chronograf/enterprise/users_test.go @@ -423,7 +423,7 @@ func TestClient_Update(t *testing.T) { fields: fields{ Ctrl: &mockCtrl{ changePassword: func(ctx context.Context, name, passwd string) error { - return fmt.Errorf("Ronald Reagan, the actor?! Ha Then who’s Vice President Jerry Lewis? I suppose Jane Wyman is First Lady") + return fmt.Errorf("ronald Reagan, the actor?! Ha Then who’s Vice President Jerry Lewis? I suppose Jane Wyman is First Lady") }, }, }, @@ -501,7 +501,7 @@ func TestClient_Update(t *testing.T) { fields: fields{ Ctrl: &mockCtrl{ setUserPerms: func(ctx context.Context, name string, perms enterprise.Permissions) error { - return fmt.Errorf("They found me, I don't know how, but they found me.") + return fmt.Errorf("they found me, I don't know how, but they found me.") }, userRoles: func(ctx context.Context) (map[string]enterprise.Roles, error) { return map[string]enterprise.Roles{}, nil diff --git a/chronograf/filestore/apps_test.go b/chronograf/filestore/apps_test.go index 11f6243df85..da62431809e 100644 --- a/chronograf/filestore/apps_test.go +++ b/chronograf/filestore/apps_test.go @@ -40,7 +40,7 @@ func TestAll(t *testing.T) { }, { Existing: nil, - Err: errors.New("Error"), + Err: errors.New("error"), }, } for i, test := range tests { @@ -92,7 +92,7 @@ func TestAdd(t *testing.T) { Application: "newbie", }, ExpectedID: "", - Err: errors.New("Error"), + Err: errors.New("error"), }, } for i, test := range tests { @@ -143,7 +143,7 @@ func TestDelete(t *testing.T) { Existing: nil, DeleteID: "1", Expected: map[string]chronograf.Layout{}, - Err: errors.New("Error"), + Err: errors.New("error"), }, } for i, test := range tests { diff --git a/chronograf/filestore/kapacitors.go b/chronograf/filestore/kapacitors.go index 61abd049edf..4240e149cbb 100644 --- a/chronograf/filestore/kapacitors.go +++ b/chronograf/filestore/kapacitors.go @@ -59,7 +59,7 @@ func (d *Kapacitors) All(ctx context.Context) ([]chronograf.Server, error) { } var kapacitor chronograf.Server if err := d.Load(path.Join(d.Dir, file.Name()), &kapacitor); err != nil { - var fmtErr = fmt.Errorf("Error loading kapacitor configuration from %v:\n%v", path.Join(d.Dir, file.Name()), err) + var fmtErr = fmt.Errorf("error loading kapacitor configuration from %v:\n%v", path.Join(d.Dir, file.Name()), err) d.Logger.Error(fmtErr) continue // We want to load all files we can. } else { diff --git a/chronograf/filestore/sources.go b/chronograf/filestore/sources.go index e9935832926..f057285e4cc 100644 --- a/chronograf/filestore/sources.go +++ b/chronograf/filestore/sources.go @@ -59,7 +59,7 @@ func (d *Sources) All(ctx context.Context) ([]chronograf.Source, error) { } var source chronograf.Source if err := d.Load(path.Join(d.Dir, file.Name()), &source); err != nil { - var fmtErr = fmt.Errorf("Error loading source configuration from %v:\n%v", path.Join(d.Dir, file.Name()), err) + var fmtErr = fmt.Errorf("error loading source configuration from %v:\n%v", path.Join(d.Dir, file.Name()), err) d.Logger.Error(fmtErr) continue // We want to load all files we can. } else { diff --git a/chronograf/influx/authorization.go b/chronograf/influx/authorization.go index 35b97df0126..62ef52fe1b3 100644 --- a/chronograf/influx/authorization.go +++ b/chronograf/influx/authorization.go @@ -62,7 +62,7 @@ func (b *BearerJWT) Set(r *http.Request) error { if b.SharedSecret != "" && b.Username != "" { token, err := b.Token(b.Username) if err != nil { - return fmt.Errorf("Unable to create token") + return fmt.Errorf("unable to create token") } r.Header.Set("Authorization", "Bearer "+token) } diff --git a/chronograf/influx/influx.go b/chronograf/influx/influx.go index 02c8e69fb4f..0fdc4478688 100644 --- a/chronograf/influx/influx.go +++ b/chronograf/influx/influx.go @@ -171,7 +171,7 @@ func (c *Client) Users(ctx context.Context) chronograf.UsersStore { // Roles aren't support in OSS func (c *Client) Roles(ctx context.Context) (chronograf.RolesStore, error) { - return nil, fmt.Errorf("Roles not support in open-source InfluxDB. Roles are support in Influx Enterprise") + return nil, fmt.Errorf("roles not support in open-source InfluxDB. Roles are support in Influx Enterprise") } // Ping hits the influxdb ping endpoint and returns the type of influx diff --git a/chronograf/influx/influx_test.go b/chronograf/influx/influx_test.go index 8c5bc9ae4a5..f913e19aece 100644 --- a/chronograf/influx/influx_test.go +++ b/chronograf/influx/influx_test.go @@ -80,7 +80,7 @@ func Test_Influx_AuthorizationBearer(t *testing.T) { tokenString := strings.Split(auth, " ")[1] token, err := gojwt.Parse(tokenString, func(token *gojwt.Token) (interface{}, error) { if _, ok := token.Method.(*gojwt.SigningMethodHMAC); !ok { - return nil, fmt.Errorf("Unexpected signing method: %v", token.Header["alg"]) + return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) } return []byte("42"), nil }) diff --git a/chronograf/influx/queries/select.go b/chronograf/influx/queries/select.go index f3874e76e61..e87930812fe 100644 --- a/chronograf/influx/queries/select.go +++ b/chronograf/influx/queries/select.go @@ -26,7 +26,7 @@ func ParseSelect(q string) (*SelectStatement, error) { } s, ok := stmt.(*influxql.SelectStatement) if !ok { - return nil, fmt.Errorf("Error parsing query: not a SELECT statement") + return nil, fmt.Errorf("error parsing query: not a SELECT statement") } return &SelectStatement{s}, nil } @@ -252,7 +252,7 @@ func MarshalJSON(v interface{}) ([]byte, error) { return json.Marshal(&Wildcard{v.(*influxql.Wildcard)}) default: t := reflect.TypeOf(v) - return nil, fmt.Errorf("Error marshaling query: unknown type %s", t) + return nil, fmt.Errorf("error marshaling query: unknown type %s", t) } } @@ -282,7 +282,7 @@ func (s *Source) MarshalJSON() ([]byte, error) { } return json.Marshal(m) default: - return nil, fmt.Errorf("Error marshaling source. Subqueries not supported yet") + return nil, fmt.Errorf("error marshaling source. Subqueries not supported yet") } } diff --git a/chronograf/integrations/server_test.go b/chronograf/integrations/server_test.go index c5f05308a39..fe83fd50e44 100644 --- a/chronograf/integrations/server_test.go +++ b/chronograf/integrations/server_test.go @@ -1648,7 +1648,7 @@ func TestServer(t *testing.T) { // body: ` //{ // "code": 401, - // "message": "User does not have authorization required to set SuperAdmin status. See https://github.com/influxdata/platform/chronograf/issues/2601 for more information." + // "message": "user does not have authorization required to set SuperAdmin status. See https://github.com/influxdata/platform/chronograf/issues/2601 for more information." //}`, // }, // }, diff --git a/chronograf/memdb/kapacitors.go b/chronograf/memdb/kapacitors.go index 5c4c52632e7..4a612c093fa 100644 --- a/chronograf/memdb/kapacitors.go +++ b/chronograf/memdb/kapacitors.go @@ -26,13 +26,13 @@ func (store *KapacitorStore) All(ctx context.Context) ([]chronograf.Server, erro // Add does not have any effect func (store *KapacitorStore) Add(ctx context.Context, kap chronograf.Server) (chronograf.Server, error) { - return chronograf.Server{}, fmt.Errorf("In-memory KapacitorStore does not support adding a Kapacitor") + return chronograf.Server{}, fmt.Errorf("in-memory KapacitorStore does not support adding a Kapacitor") } // Delete removes the in-memory configured Kapacitor if its ID matches what's provided func (store *KapacitorStore) Delete(ctx context.Context, kap chronograf.Server) error { if store.Kapacitor == nil || store.Kapacitor.ID != kap.ID { - return fmt.Errorf("Unable to find Kapacitor with id %d", kap.ID) + return fmt.Errorf("unable to find Kapacitor with id %d", kap.ID) } store.Kapacitor = nil return nil @@ -41,7 +41,7 @@ func (store *KapacitorStore) Delete(ctx context.Context, kap chronograf.Server) // Get returns the in-memory Kapacitor if its ID matches what's provided func (store *KapacitorStore) Get(ctx context.Context, id int) (chronograf.Server, error) { if store.Kapacitor == nil || store.Kapacitor.ID != id { - return chronograf.Server{}, fmt.Errorf("Unable to find Kapacitor with id %d", id) + return chronograf.Server{}, fmt.Errorf("unable to find Kapacitor with id %d", id) } return *store.Kapacitor, nil } @@ -49,7 +49,7 @@ func (store *KapacitorStore) Get(ctx context.Context, id int) (chronograf.Server // Update overwrites the in-memory configured Kapacitor if its ID matches what's provided func (store *KapacitorStore) Update(ctx context.Context, kap chronograf.Server) error { if store.Kapacitor == nil || store.Kapacitor.ID != kap.ID { - return fmt.Errorf("Unable to find Kapacitor with id %d", kap.ID) + return fmt.Errorf("unable to find Kapacitor with id %d", kap.ID) } store.Kapacitor = &kap return nil diff --git a/chronograf/memdb/sources.go b/chronograf/memdb/sources.go index aedaae75c6d..5e8fb1b4adb 100644 --- a/chronograf/memdb/sources.go +++ b/chronograf/memdb/sources.go @@ -17,7 +17,7 @@ type SourcesStore struct { // Add does not have any effect func (store *SourcesStore) Add(ctx context.Context, src chronograf.Source) (chronograf.Source, error) { - return chronograf.Source{}, fmt.Errorf("In-memory SourcesStore does not support adding a Source") + return chronograf.Source{}, fmt.Errorf("in-memory SourcesStore does not support adding a Source") } // All will return a slice containing a configured source @@ -31,7 +31,7 @@ func (store *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error) // Delete removes the SourcesStore.Soruce if it matches the provided Source func (store *SourcesStore) Delete(ctx context.Context, src chronograf.Source) error { if store.Source == nil || store.Source.ID != src.ID { - return fmt.Errorf("Unable to find Source with id %d", src.ID) + return fmt.Errorf("unable to find Source with id %d", src.ID) } store.Source = nil return nil @@ -40,7 +40,7 @@ func (store *SourcesStore) Delete(ctx context.Context, src chronograf.Source) er // Get returns the configured source if the id matches func (store *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error) { if store.Source == nil || store.Source.ID != id { - return chronograf.Source{}, fmt.Errorf("Unable to find Source with id %d", id) + return chronograf.Source{}, fmt.Errorf("unable to find Source with id %d", id) } return *store.Source, nil } @@ -48,7 +48,7 @@ func (store *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, // Update does nothing func (store *SourcesStore) Update(ctx context.Context, src chronograf.Source) error { if store.Source == nil || store.Source.ID != src.ID { - return fmt.Errorf("Unable to find Source with id %d", src.ID) + return fmt.Errorf("unable to find Source with id %d", src.ID) } store.Source = &src return nil diff --git a/chronograf/multistore/organizations.go b/chronograf/multistore/organizations.go index 2ae28eac965..12c2cbc7aeb 100644 --- a/chronograf/multistore/organizations.go +++ b/chronograf/multistore/organizations.go @@ -59,7 +59,7 @@ func (multi *OrganizationsStore) Add(ctx context.Context, org *chronograf.Organi } errors = append(errors, err.Error()) } - return nil, fmt.Errorf("Unknown error while adding organization: %s", strings.Join(errors, " ")) + return nil, fmt.Errorf("unknown error while adding organization: %s", strings.Join(errors, " ")) } // Delete delegates to all Stores, returns success if one Store is successful @@ -72,7 +72,7 @@ func (multi *OrganizationsStore) Delete(ctx context.Context, org *chronograf.Org } errors = append(errors, err.Error()) } - return fmt.Errorf("Unknown error while deleting organization: %s", strings.Join(errors, " ")) + return fmt.Errorf("unknown error while deleting organization: %s", strings.Join(errors, " ")) } // Get finds the Organization by id among all contained Stores @@ -98,7 +98,7 @@ func (multi *OrganizationsStore) Update(ctx context.Context, org *chronograf.Org } errors = append(errors, err.Error()) } - return fmt.Errorf("Unknown error while updating organization: %s", strings.Join(errors, " ")) + return fmt.Errorf("unknown error while updating organization: %s", strings.Join(errors, " ")) } // CreateDefault makes a default organization in the first responsive Store @@ -111,7 +111,7 @@ func (multi *OrganizationsStore) CreateDefault(ctx context.Context) error { } errors = append(errors, err.Error()) } - return fmt.Errorf("Unknown error while creating default organization: %s", strings.Join(errors, " ")) + return fmt.Errorf("unknown error while creating default organization: %s", strings.Join(errors, " ")) } // DefaultOrganization returns the first successful DefaultOrganization @@ -124,6 +124,6 @@ func (multi *OrganizationsStore) DefaultOrganization(ctx context.Context) (*chro } errors = append(errors, err.Error()) } - return nil, fmt.Errorf("Unknown error while getting default organization: %s", strings.Join(errors, " ")) + return nil, fmt.Errorf("unknown error while getting default organization: %s", strings.Join(errors, " ")) } diff --git a/chronograf/oauth2/generic.go b/chronograf/oauth2/generic.go index ef66f754cd1..c14d739e1fc 100644 --- a/chronograf/oauth2/generic.go +++ b/chronograf/oauth2/generic.go @@ -111,9 +111,8 @@ func (g *Generic) PrincipalID(provider *http.Client) (string, error) { if len(g.Domains) > 0 { // If not in the domain deny permission if ok := ofDomain(g.Domains, email); !ok { - msg := "Not a member of required domain" - g.Logger.Error(msg) - return "", fmt.Errorf(msg) + g.Logger.Error("Not a member of required domain.") + return "", fmt.Errorf("not a member of required domain") } } @@ -193,7 +192,7 @@ func (g *Generic) primaryEmail(emails []*UserEmail) (string, error) { return *m.Email, nil } } - return "", errors.New("No primary email address") + return "", errors.New("no primary email address") } // ofDomain makes sure that the email is in one of the required domains diff --git a/chronograf/oauth2/github.go b/chronograf/oauth2/github.go index 9558a5bc51f..e77e6c8fe47 100644 --- a/chronograf/oauth2/github.go +++ b/chronograf/oauth2/github.go @@ -180,7 +180,7 @@ func primaryEmail(emails []*github.UserEmail) (string, error) { return *m.Email, nil } } - return "", errors.New("No primary email address") + return "", errors.New("no primary email address") } func getPrimary(m *github.UserEmail) bool { diff --git a/chronograf/oauth2/google.go b/chronograf/oauth2/google.go index 78a5594ad81..94833061201 100644 --- a/chronograf/oauth2/google.go +++ b/chronograf/oauth2/google.go @@ -86,7 +86,7 @@ func (g *Google) PrincipalID(provider *http.Client) (string, error) { } } g.Logger.Error("Domain '", info.Hd, "' is not a member of required Google domain(s): ", g.Domains) - return "", fmt.Errorf("Not in required domain") + return "", fmt.Errorf("not in required domain") } // Group returns the string of domain a user belongs to in Google diff --git a/chronograf/oauth2/heroku.go b/chronograf/oauth2/heroku.go index a44d75fa121..5e903c62bbc 100644 --- a/chronograf/oauth2/heroku.go +++ b/chronograf/oauth2/heroku.go @@ -72,7 +72,7 @@ func (h *Heroku) PrincipalID(provider *http.Client) (string, error) { resp, err := provider.Do(req) if resp.StatusCode/100 != 2 { err := fmt.Errorf( - "Unable to GET user data from %s. Status: %s", + "unable to GET user data from %s. Status: %s", HerokuAccountRoute, resp.Status, ) diff --git a/chronograf/oauth2/jwt.go b/chronograf/oauth2/jwt.go index e2cbc171e59..c5f51eee3a8 100644 --- a/chronograf/oauth2/jwt.go +++ b/chronograf/oauth2/jwt.go @@ -116,12 +116,12 @@ type JWKS struct { func (j *JWT) KeyFuncRS256(token *gojwt.Token) (interface{}, error) { // Don't forget to validate the alg is what you expect: if _, ok := token.Method.(*gojwt.SigningMethodRSA); !ok { - return nil, fmt.Errorf("Unsupported signing method: %v", token.Header["alg"]) + return nil, fmt.Errorf("unsupported signing method: %v", token.Header["alg"]) } // read JWKS document from key discovery service if j.Jwksurl == "" { - return nil, fmt.Errorf("JWKSURL not specified, cannot validate RS256 signature") + return nil, fmt.Errorf("token JWKSURL not specified, cannot validate RS256 signature") } rr, err := http.Get(j.Jwksurl) diff --git a/chronograf/oauth2/jwt_test.go b/chronograf/oauth2/jwt_test.go index 17205f0a55b..f640fe8af68 100644 --- a/chronograf/oauth2/jwt_test.go +++ b/chronograf/oauth2/jwt_test.go @@ -155,8 +155,8 @@ func TestSigningMethod(t *testing.T) { j := oauth2.JWT{} if _, err := j.ValidPrincipal(context.Background(), token, 0); err == nil { t.Error("Error was expected while validating incorrectly signed token") - } else if err.Error() != "JWKSURL not specified, cannot validate RS256 signature" { - t.Errorf("Error wanted 'JWKSURL not specified, cannot validate RS256 signature', got %s", err.Error()) + } else if err.Error() != "token JWKSURL not specified, cannot validate RS256 signature" { + t.Errorf("Error wanted 'token JWKSURL not specified, cannot validate RS256 signature', got %s", err.Error()) } } diff --git a/chronograf/oauth2/oauth2.go b/chronograf/oauth2/oauth2.go index 05f38a7414e..5788a882fd9 100644 --- a/chronograf/oauth2/oauth2.go +++ b/chronograf/oauth2/oauth2.go @@ -24,7 +24,7 @@ var ( // ErrAuthentication means that oauth2 exchange failed ErrAuthentication = errors.New("user not authenticated") // ErrOrgMembership means that the user is not in the OAuth2 filtered group - ErrOrgMembership = errors.New("Not a member of the required organization") + ErrOrgMembership = errors.New("not a member of the required organization") ) /* Types */ diff --git a/chronograf/organizations/dashboards_test.go b/chronograf/organizations/dashboards_test.go index 8ff68270821..3fa31a97500 100644 --- a/chronograf/organizations/dashboards_test.go +++ b/chronograf/organizations/dashboards_test.go @@ -39,7 +39,7 @@ func TestDashboards_All(t *testing.T) { fields: fields{ DashboardsStore: &mocks.DashboardsStore{ AllF: func(ctx context.Context) ([]chronograf.Dashboard, error) { - return nil, fmt.Errorf("No Dashboards") + return nil, fmt.Errorf("no Dashboards") }, }, }, diff --git a/chronograf/organizations/organizations_test.go b/chronograf/organizations/organizations_test.go index e95398f1ceb..689129dbcf5 100644 --- a/chronograf/organizations/organizations_test.go +++ b/chronograf/organizations/organizations_test.go @@ -39,7 +39,7 @@ func TestOrganizations_All(t *testing.T) { fields: fields{ OrganizationsStore: &mocks.OrganizationsStore{ AllF: func(ctx context.Context) ([]chronograf.Organization, error) { - return nil, fmt.Errorf("No Organizations") + return nil, fmt.Errorf("no Organizations") }, DefaultOrganizationF: func(ctx context.Context) (*chronograf.Organization, error) { return &chronograf.Organization{ diff --git a/chronograf/organizations/servers_test.go b/chronograf/organizations/servers_test.go index 64eafea6945..ab0dffa00f6 100644 --- a/chronograf/organizations/servers_test.go +++ b/chronograf/organizations/servers_test.go @@ -40,7 +40,7 @@ func TestServers_All(t *testing.T) { fields: fields{ ServersStore: &mocks.ServersStore{ AllF: func(ctx context.Context) ([]chronograf.Server, error) { - return nil, fmt.Errorf("No Servers") + return nil, fmt.Errorf("no Servers") }, }, }, diff --git a/chronograf/organizations/sources_test.go b/chronograf/organizations/sources_test.go index e97030f4f14..a8cc6ab420e 100644 --- a/chronograf/organizations/sources_test.go +++ b/chronograf/organizations/sources_test.go @@ -40,7 +40,7 @@ func TestSources_All(t *testing.T) { fields: fields{ SourcesStore: &mocks.SourcesStore{ AllF: func(ctx context.Context) ([]chronograf.Source, error) { - return nil, fmt.Errorf("No Sources") + return nil, fmt.Errorf("no Sources") }, }, }, diff --git a/chronograf/server/annotations.go b/chronograf/server/annotations.go index 77c58c28647..4abddaa13cd 100644 --- a/chronograf/server/annotations.go +++ b/chronograf/server/annotations.go @@ -113,13 +113,13 @@ func (s *Service) Annotations(w http.ResponseWriter, r *http.Request) { ts, err := s.TimeSeries(src) if err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", id, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", id, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } if err = ts.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", id, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", id, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } @@ -127,7 +127,7 @@ func (s *Service) Annotations(w http.ResponseWriter, r *http.Request) { store := influx.NewAnnotationStore(ts) annotations, err := store.All(ctx, start, stop) if err != nil { - msg := fmt.Errorf("Error loading annotations: %v", err) + msg := fmt.Errorf("error loading annotations: %v", err) unknownErrorWithMessage(w, msg, s.Logger) return } @@ -158,13 +158,13 @@ func (s *Service) Annotation(w http.ResponseWriter, r *http.Request) { ts, err := s.TimeSeries(src) if err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", id, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", id, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } if err = ts.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", id, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", id, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } @@ -173,7 +173,7 @@ func (s *Service) Annotation(w http.ResponseWriter, r *http.Request) { anno, err := store.Get(ctx, annoID) if err != nil { if err != chronograf.ErrAnnotationNotFound { - msg := fmt.Errorf("Error loading annotation: %v", err) + msg := fmt.Errorf("error loading annotation: %v", err) unknownErrorWithMessage(w, msg, s.Logger) return } @@ -249,13 +249,13 @@ func (s *Service) NewAnnotation(w http.ResponseWriter, r *http.Request) { ts, err := s.TimeSeries(src) if err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", id, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", id, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } if err = ts.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", id, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", id, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } @@ -306,13 +306,13 @@ func (s *Service) RemoveAnnotation(w http.ResponseWriter, r *http.Request) { ts, err := s.TimeSeries(src) if err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", id, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", id, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } if err = ts.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", id, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", id, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } @@ -399,13 +399,13 @@ func (s *Service) UpdateAnnotation(w http.ResponseWriter, r *http.Request) { ts, err := s.TimeSeries(src) if err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", id, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", id, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } if err = ts.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", id, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", id, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } diff --git a/chronograf/server/annotations_test.go b/chronograf/server/annotations_test.go index 66d18ba8ebb..699a9a50080 100644 --- a/chronograf/server/annotations_test.go +++ b/chronograf/server/annotations_test.go @@ -31,7 +31,7 @@ func TestService_Annotations(t *testing.T) { name: "error no id", w: httptest.NewRecorder(), r: httptest.NewRequest("GET", "/chronograf/v1/sources/1/annotations", bytes.NewReader([]byte(`howdy`))), - want: `{"code":422,"message":"Error converting ID "}`, + want: `{"code":422,"message":"error converting ID "}`, }, { name: "no since parameter", @@ -84,7 +84,7 @@ func TestService_Annotations(t *testing.T) { ID: "1", w: httptest.NewRecorder(), r: httptest.NewRequest("GET", "/chronograf/v1/sources/1/annotations?since=1985-04-12T23:20:50.52Z", bytes.NewReader([]byte(`howdy`))), - want: `{"code":400,"message":"Unable to connect to source 1: error)"}`, + want: `{"code":400,"message":"unable to connect to source 1: error)"}`, }, { name: "error returned when annotations are invalid", @@ -110,7 +110,7 @@ func TestService_Annotations(t *testing.T) { ID: "1", w: httptest.NewRecorder(), r: httptest.NewRequest("GET", "/chronograf/v1/sources/1/annotations?since=1985-04-12T23:20:50.52Z", bytes.NewReader([]byte(`howdy`))), - want: `{"code":500,"message":"Unknown error: Error loading annotations: invalid character '[' looking for beginning of object key string"}`, + want: `{"code":500,"message":"unknown error: error loading annotations: invalid character '[' looking for beginning of object key string"}`, }, { name: "error is returned connect is an error", diff --git a/chronograf/server/auth_test.go b/chronograf/server/auth_test.go index a6a3c818dc3..affdf238db4 100644 --- a/chronograf/server/auth_test.go +++ b/chronograf/server/auth_test.go @@ -113,7 +113,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -137,7 +137,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -169,7 +169,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -193,7 +193,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -225,7 +225,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -249,7 +249,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -281,7 +281,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -305,7 +305,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -337,7 +337,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -361,7 +361,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -393,7 +393,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -417,7 +417,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -449,7 +449,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -473,7 +473,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -505,7 +505,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -529,7 +529,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -557,7 +557,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -581,7 +581,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -613,7 +613,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -637,7 +637,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -669,7 +669,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -693,7 +693,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -721,7 +721,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -745,7 +745,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -773,7 +773,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -797,7 +797,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -829,7 +829,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -848,7 +848,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -876,7 +876,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -895,7 +895,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -923,7 +923,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -942,7 +942,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -970,7 +970,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -993,7 +993,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1021,7 +1021,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -1039,7 +1039,7 @@ func TestAuthorizedUser(t *testing.T) { OrganizationsStore: &mocks.OrganizationsStore{ GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1072,7 +1072,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -1095,7 +1095,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1123,7 +1123,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -1147,7 +1147,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1175,7 +1175,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -1199,7 +1199,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1227,7 +1227,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -1251,7 +1251,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1279,7 +1279,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -1304,7 +1304,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1336,7 +1336,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -1361,7 +1361,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1393,7 +1393,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -1418,7 +1418,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1450,7 +1450,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -1475,7 +1475,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1507,7 +1507,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -1531,7 +1531,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1555,7 +1555,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -1579,7 +1579,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1606,7 +1606,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -1630,7 +1630,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1658,7 +1658,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ ID: 1337, @@ -1682,7 +1682,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } switch *q.ID { case "1338": @@ -1715,7 +1715,7 @@ func TestAuthorizedUser(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } switch *q.Name { case "billysteve": @@ -1744,7 +1744,7 @@ func TestAuthorizedUser(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", diff --git a/chronograf/server/cells.go b/chronograf/server/cells.go index 6a2c9d5afc3..6d2e8cf78d3 100644 --- a/chronograf/server/cells.go +++ b/chronograf/server/cells.go @@ -71,7 +71,7 @@ func newCellResponses(dID chronograf.DashboardID, dcells []chronograf.DashboardC // have the correct axes specified func ValidDashboardCellRequest(c *chronograf.DashboardCell) error { if c == nil { - return fmt.Errorf("Chronograf dashboard cell was nil") + return fmt.Errorf("chronograf dashboard cell was nil") } CorrectWidthHeight(c) diff --git a/chronograf/server/cells_test.go b/chronograf/server/cells_test.go index 42917b417b5..eea3557bd07 100644 --- a/chronograf/server/cells_test.go +++ b/chronograf/server/cells_test.go @@ -620,7 +620,7 @@ func TestService_ReplaceDashboardCell(t *testing.T) { }, w: httptest.NewRecorder(), r: httptest.NewRequest("PUT", "/chronograf/v1/dashboards/1/cells/3c5c4102-fa40-4585-a8f9-917c77e37192", nil), - want: `{"code":400,"message":"Unparsable JSON"}`, + want: `{"code":400,"message":"unparsable JSON"}`, }, { name: "not able to update store returns error message", diff --git a/chronograf/server/dashboards.go b/chronograf/server/dashboards.go index a531d14caf0..e4f87370b39 100644 --- a/chronograf/server/dashboards.go +++ b/chronograf/server/dashboards.go @@ -107,7 +107,7 @@ func (s *Service) NewDashboard(w http.ResponseWriter, r *http.Request) { } if dashboard, err = s.Store.Dashboards(ctx).Add(r.Context(), dashboard); err != nil { - msg := fmt.Errorf("Error storing dashboard %v: %v", dashboard, err) + msg := fmt.Errorf("error storing dashboard %v: %v", dashboard, err) unknownErrorWithMessage(w, msg, s.Logger) return } @@ -221,7 +221,7 @@ func (s *Service) UpdateDashboard(w http.ResponseWriter, r *http.Request) { } orig.Cells = req.Cells } else { - invalidData(w, fmt.Errorf("Update must include either name or cells"), s.Logger) + invalidData(w, fmt.Errorf("update must include either name or cells"), s.Logger) return } diff --git a/chronograf/server/databases.go b/chronograf/server/databases.go index 49f1a090aa0..0c3bceb6476 100644 --- a/chronograf/server/databases.go +++ b/chronograf/server/databases.go @@ -115,7 +115,7 @@ func (h *Service) GetDatabases(w http.ResponseWriter, r *http.Request) { dbsvc := h.Databases if err = dbsvc.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", srcID, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err) Error(w, http.StatusBadRequest, msg, h.Logger) return } @@ -162,7 +162,7 @@ func (h *Service) NewDatabase(w http.ResponseWriter, r *http.Request) { dbsvc := h.Databases if err = dbsvc.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", srcID, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err) Error(w, http.StatusBadRequest, msg, h.Logger) return } @@ -212,7 +212,7 @@ func (h *Service) DropDatabase(w http.ResponseWriter, r *http.Request) { dbsvc := h.Databases if err = dbsvc.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", srcID, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err) Error(w, http.StatusBadRequest, msg, h.Logger) return } @@ -246,7 +246,7 @@ func (h *Service) RetentionPolicies(w http.ResponseWriter, r *http.Request) { dbsvc := h.Databases if err = dbsvc.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", srcID, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err) Error(w, http.StatusBadRequest, msg, h.Logger) return } @@ -254,7 +254,7 @@ func (h *Service) RetentionPolicies(w http.ResponseWriter, r *http.Request) { db := httprouter.ParamsFromContext(ctx).ByName("db") res, err := h.allRPs(ctx, dbsvc, srcID, db) if err != nil { - msg := fmt.Sprintf("Unable to connect get RPs %d: %v", srcID, err) + msg := fmt.Sprintf("unable to connect get RPs %d: %v", srcID, err) Error(w, http.StatusBadRequest, msg, h.Logger) return } @@ -300,7 +300,7 @@ func (h *Service) NewRetentionPolicy(w http.ResponseWriter, r *http.Request) { dbsvc := h.Databases if err = dbsvc.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", srcID, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err) Error(w, http.StatusBadRequest, msg, h.Logger) return } @@ -350,7 +350,7 @@ func (h *Service) UpdateRetentionPolicy(w http.ResponseWriter, r *http.Request) dbsvc := h.Databases if err = dbsvc.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", srcID, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err) Error(w, http.StatusBadRequest, msg, h.Logger) return } @@ -404,7 +404,7 @@ func (s *Service) DropRetentionPolicy(w http.ResponseWriter, r *http.Request) { dbsvc := s.Databases if err = dbsvc.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", srcID, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } @@ -445,7 +445,7 @@ func (h *Service) Measurements(w http.ResponseWriter, r *http.Request) { dbsvc := h.Databases if err = dbsvc.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", srcID, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err) Error(w, http.StatusBadRequest, msg, h.Logger) return } diff --git a/chronograf/server/influx.go b/chronograf/server/influx.go index 62e15601e15..fda0deb2d83 100644 --- a/chronograf/server/influx.go +++ b/chronograf/server/influx.go @@ -53,13 +53,13 @@ func (s *Service) Influx(w http.ResponseWriter, r *http.Request) { ts, err := s.TimeSeries(src) if err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", id, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", id, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } if err = ts.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", id, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", id, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } diff --git a/chronograf/server/kapacitors.go b/chronograf/server/kapacitors.go index 55c166ce785..3fc09da3a7b 100644 --- a/chronograf/server/kapacitors.go +++ b/chronograf/server/kapacitors.go @@ -26,7 +26,7 @@ package server // return fmt.Errorf("invalid source URI: %v", err) // } // if len(url.Scheme) == 0 { -// return fmt.Errorf("Invalid URL; no URL scheme defined") +// return fmt.Errorf("invalid URL; no URL scheme defined") // } // // return nil @@ -95,7 +95,7 @@ package server // } // // if srv, err = s.Store.Servers(ctx).Add(ctx, srv); err != nil { -// msg := fmt.Errorf("Error storing kapacitor %v: %v", req, err) +// msg := fmt.Errorf("error storing kapacitor %v: %v", req, err) // unknownErrorWithMessage(w, msg, s.Logger) // return // } @@ -227,7 +227,7 @@ package server // return fmt.Errorf("invalid source URI: %v", err) // } // if len(url.Scheme) == 0 { -// return fmt.Errorf("Invalid URL; no URL scheme defined") +// return fmt.Errorf("invalid URL; no URL scheme defined") // } // } // return nil @@ -604,7 +604,7 @@ package server // if k.Status == "enabled" || k.Status == "disabled" { // return nil // } -// return fmt.Errorf("Invalid Kapacitor status: %s", k.Status) +// return fmt.Errorf("invalid Kapacitor status: %s", k.Status) //} // //// KapacitorRulesStatus proxies PATCH to kapacitor to enable/disable tasks diff --git a/chronograf/server/links.go b/chronograf/server/links.go index ae5555dfac9..acfdfd7cf50 100644 --- a/chronograf/server/links.go +++ b/chronograf/server/links.go @@ -38,10 +38,10 @@ func NewCustomLinks(links map[string]string) ([]CustomLink, error) { customLinks := make([]CustomLink, 0, len(links)) for name, link := range links { if name == "" { - return nil, errors.New("CustomLink missing key for Name") + return nil, errors.New("customLink missing key for Name") } if link == "" { - return nil, errors.New("CustomLink missing value for URL") + return nil, errors.New("customLink missing value for URL") } _, err := url.Parse(link) if err != nil { diff --git a/chronograf/server/me.go b/chronograf/server/me.go index 235550420b1..4525e593b98 100644 --- a/chronograf/server/me.go +++ b/chronograf/server/me.go @@ -64,7 +64,7 @@ func getScheme(ctx context.Context) (string, error) { func getPrincipal(ctx context.Context) (oauth2.Principal, error) { principal, ok := ctx.Value(oauth2.PrincipalKey).(oauth2.Principal) if !ok { - return oauth2.Principal{}, fmt.Errorf("Token not found") + return oauth2.Principal{}, fmt.Errorf("token not found") } return principal, nil @@ -76,10 +76,10 @@ func getValidPrincipal(ctx context.Context) (oauth2.Principal, error) { return p, err } if p.Subject == "" { - return oauth2.Principal{}, fmt.Errorf("Token not found") + return oauth2.Principal{}, fmt.Errorf("token not found") } if p.Issuer == "" { - return oauth2.Principal{}, fmt.Errorf("Token not found") + return oauth2.Principal{}, fmt.Errorf("token not found") } return p, nil } diff --git a/chronograf/server/me_test.go b/chronograf/server/me_test.go index 70db5bd7462..561e684d153 100644 --- a/chronograf/server/me_test.go +++ b/chronograf/server/me_test.go @@ -100,7 +100,7 @@ func TestService_Me(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ Name: "me", @@ -167,7 +167,7 @@ func TestService_Me(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ Name: "me", @@ -226,7 +226,7 @@ func TestService_Me(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ Name: "me", @@ -308,7 +308,7 @@ func TestService_Me(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return nil, chronograf.ErrUserNotFound }, @@ -388,7 +388,7 @@ func TestService_Me(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return nil, chronograf.ErrUserNotFound }, @@ -468,7 +468,7 @@ func TestService_Me(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return nil, chronograf.ErrUserNotFound }, @@ -540,7 +540,7 @@ func TestService_Me(t *testing.T) { return nil, chronograf.ErrUserNotFound }, AddF: func(ctx context.Context, u *chronograf.User) (*chronograf.User, error) { - return nil, fmt.Errorf("Why Heavy?") + return nil, fmt.Errorf("why Heavy?") }, UpdateF: func(ctx context.Context, u *chronograf.User) error { return nil @@ -637,7 +637,7 @@ func TestService_Me(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return nil, chronograf.ErrUserNotFound }, @@ -704,7 +704,7 @@ func TestService_Me(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return nil, chronograf.ErrUserNotFound }, @@ -772,7 +772,7 @@ func TestService_Me(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return nil, chronograf.ErrUserNotFound }, @@ -847,7 +847,7 @@ func TestService_Me(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return nil, chronograf.ErrUserNotFound }, @@ -922,7 +922,7 @@ func TestService_Me(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return nil, chronograf.ErrUserNotFound }, @@ -993,7 +993,7 @@ func TestService_Me(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ Name: "secret", @@ -1074,7 +1074,7 @@ func TestService_Me(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ Name: "secret", @@ -1180,7 +1180,7 @@ func TestService_UpdateMe(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ Name: "me", @@ -1208,7 +1208,7 @@ func TestService_UpdateMe(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } switch *q.ID { case "0": @@ -1251,7 +1251,7 @@ func TestService_UpdateMe(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ Name: "me", @@ -1279,7 +1279,7 @@ func TestService_UpdateMe(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } switch *q.ID { case "1337": @@ -1323,7 +1323,7 @@ func TestService_UpdateMe(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ Name: "me", @@ -1349,7 +1349,7 @@ func TestService_UpdateMe(t *testing.T) { }, GetF: func(ctx context.Context, q chronograf.OrganizationQuery) (*chronograf.Organization, error) { if q.ID == nil { - return nil, fmt.Errorf("Invalid organization query: missing ID") + return nil, fmt.Errorf("invalid organization query: missing ID") } return &chronograf.Organization{ ID: "1337", @@ -1383,7 +1383,7 @@ func TestService_UpdateMe(t *testing.T) { UsersStore: &mocks.UsersStore{ GetF: func(ctx context.Context, q chronograf.UserQuery) (*chronograf.User, error) { if q.Name == nil || q.Provider == nil || q.Scheme == nil { - return nil, fmt.Errorf("Invalid user query: missing Name, Provider, and/or Scheme") + return nil, fmt.Errorf("invalid user query: missing Name, Provider, and/or Scheme") } return &chronograf.User{ Name: "me", diff --git a/chronograf/server/mux.go b/chronograf/server/mux.go index aa9bd8a46bb..98333cc1d98 100644 --- a/chronograf/server/mux.go +++ b/chronograf/server/mux.go @@ -427,11 +427,11 @@ func invalidData(w http.ResponseWriter, err error, logger chronograf.Logger) { } func invalidJSON(w http.ResponseWriter, logger chronograf.Logger) { - Error(w, http.StatusBadRequest, "Unparsable JSON", logger) + Error(w, http.StatusBadRequest, "unparsable JSON", logger) } func unknownErrorWithMessage(w http.ResponseWriter, err error, logger chronograf.Logger) { - Error(w, http.StatusInternalServerError, fmt.Sprintf("Unknown error: %v", err), logger) + Error(w, http.StatusInternalServerError, fmt.Sprintf("unknown error: %v", err), logger) } func notFound(w http.ResponseWriter, id interface{}, logger chronograf.Logger) { @@ -443,7 +443,7 @@ func paramID(key string, r *http.Request) (int, error) { param := jhttprouter.ParamsFromContext(ctx).ByName(key) id, err := strconv.Atoi(param) if err != nil { - return -1, fmt.Errorf("Error converting ID %s", param) + return -1, fmt.Errorf("error converting ID %s", param) } return id, nil } diff --git a/chronograf/server/org_config.go b/chronograf/server/org_config.go index 70d815030d0..b668ae5708f 100644 --- a/chronograf/server/org_config.go +++ b/chronograf/server/org_config.go @@ -127,7 +127,7 @@ func (s *Service) ReplaceOrganizationLogViewerConfig(w http.ResponseWriter, r *h // at least one severity format of type icon, text, or both func validLogViewerConfig(c chronograf.LogViewerConfig) error { if len(c.Columns) == 0 { - return fmt.Errorf("Invalid log viewer config: must have at least 1 column") + return fmt.Errorf("invalid log viewer config: must have at least 1 column") } nameMatcher := map[string]bool{} @@ -140,11 +140,11 @@ func validLogViewerConfig(c chronograf.LogViewerConfig) error { // check that each column has a unique value for the name and position properties if _, ok := nameMatcher[clm.Name]; ok { - return fmt.Errorf("Invalid log viewer config: Duplicate column name %s", clm.Name) + return fmt.Errorf("invalid log viewer config: Duplicate column name %s", clm.Name) } nameMatcher[clm.Name] = true if _, ok := positionMatcher[clm.Position]; ok { - return fmt.Errorf("Invalid log viewer config: Multiple columns with same position value") + return fmt.Errorf("invalid log viewer config: Multiple columns with same position value") } positionMatcher[clm.Position] = true @@ -152,7 +152,7 @@ func validLogViewerConfig(c chronograf.LogViewerConfig) error { if e.Type == "visibility" { visibility++ if !(e.Value == "visible" || e.Value == "hidden") { - return fmt.Errorf("Invalid log viewer config: invalid visibility in column %s", clm.Name) + return fmt.Errorf("invalid log viewer config: invalid visibility in column %s", clm.Name) } } @@ -166,12 +166,12 @@ func validLogViewerConfig(c chronograf.LogViewerConfig) error { } if visibility != 1 { - return fmt.Errorf("Invalid log viewer config: missing visibility encoding in column %s", clm.Name) + return fmt.Errorf("invalid log viewer config: missing visibility encoding in column %s", clm.Name) } if clm.Name == "severity" { if iconCount+textCount == 0 || iconCount > 1 || textCount > 1 { - return fmt.Errorf("Invalid log viewer config: invalid number of severity format encodings in column %s", clm.Name) + return fmt.Errorf("invalid log viewer config: invalid number of severity format encodings in column %s", clm.Name) } } } diff --git a/chronograf/server/org_config_test.go b/chronograf/server/org_config_test.go index 3b5d1179409..b40e1f82dc0 100644 --- a/chronograf/server/org_config_test.go +++ b/chronograf/server/org_config_test.go @@ -462,7 +462,7 @@ func TestReplaceLogViewerOrganizationConfig(t *testing.T) { wants: wants{ statusCode: 400, contentType: "application/json", - body: `{"code":400,"message":"Invalid log viewer config: must have at least 1 column"}`, + body: `{"code":400,"message":"invalid log viewer config: must have at least 1 column"}`, }, }, { @@ -527,7 +527,7 @@ func TestReplaceLogViewerOrganizationConfig(t *testing.T) { wants: wants{ statusCode: 400, contentType: "application/json", - body: `{"code":400,"message":"Invalid log viewer config: Duplicate column name procid"}`, + body: `{"code":400,"message":"invalid log viewer config: Duplicate column name procid"}`, }, }, { @@ -592,7 +592,7 @@ func TestReplaceLogViewerOrganizationConfig(t *testing.T) { wants: wants{ statusCode: 400, contentType: "application/json", - body: `{"code":400,"message":"Invalid log viewer config: Multiple columns with same position value"}`, + body: `{"code":400,"message":"invalid log viewer config: Multiple columns with same position value"}`, }, }, { @@ -662,7 +662,7 @@ func TestReplaceLogViewerOrganizationConfig(t *testing.T) { wants: wants{ statusCode: 400, contentType: "application/json", - body: `{"code":400,"message":"Invalid log viewer config: missing visibility encoding in column severity"}`, + body: `{"code":400,"message":"invalid log viewer config: missing visibility encoding in column severity"}`, }, }, } diff --git a/chronograf/server/organizations.go b/chronograf/server/organizations.go index 92451b97e18..418ebbf640b 100644 --- a/chronograf/server/organizations.go +++ b/chronograf/server/organizations.go @@ -19,7 +19,7 @@ type organizationRequest struct { func (r *organizationRequest) ValidCreate() error { if r.Name == "" { - return fmt.Errorf("Name required on Chronograf Organization request body") + return fmt.Errorf("name required on Chronograf Organization request body") } return r.ValidDefaultRole() @@ -27,7 +27,7 @@ func (r *organizationRequest) ValidCreate() error { func (r *organizationRequest) ValidUpdate() error { if r.Name == "" && r.DefaultRole == "" { - return fmt.Errorf("No fields to update") + return fmt.Errorf("no fields to update") } if r.DefaultRole != "" { diff --git a/chronograf/server/organizations_test.go b/chronograf/server/organizations_test.go index f760076ccb7..05e585879c2 100644 --- a/chronograf/server/organizations_test.go +++ b/chronograf/server/organizations_test.go @@ -56,7 +56,7 @@ func TestService_OrganizationID(t *testing.T) { Name: "The Good Place", }, nil default: - return nil, fmt.Errorf("Organization with ID %s not found", *q.ID) + return nil, fmt.Errorf("organization with ID %s not found", *q.ID) } }, }, @@ -87,7 +87,7 @@ func TestService_OrganizationID(t *testing.T) { Name: "The Good Place", }, nil default: - return nil, fmt.Errorf("Organization with ID %s not found", *q.ID) + return nil, fmt.Errorf("organization with ID %s not found", *q.ID) } }, }, @@ -295,7 +295,7 @@ func TestService_UpdateOrganization(t *testing.T) { id: "1337", wantStatus: http.StatusUnprocessableEntity, wantContentType: "application/json", - wantBody: `{"code":422,"message":"No fields to update"}`, + wantBody: `{"code":422,"message":"no fields to update"}`, }, { name: "Update Organization default role", @@ -355,7 +355,7 @@ func TestService_UpdateOrganization(t *testing.T) { id: "1337", wantStatus: http.StatusUnprocessableEntity, wantContentType: "application/json", - wantBody: `{"code":422,"message":"No fields to update"}`, + wantBody: `{"code":422,"message":"no fields to update"}`, }, { name: "Update Organization - invalid role", @@ -466,7 +466,7 @@ func TestService_RemoveOrganization(t *testing.T) { Name: "The Good Place", }, nil default: - return nil, fmt.Errorf("Organization with ID %s not found", *q.ID) + return nil, fmt.Errorf("organization with ID %s not found", *q.ID) } }, }, @@ -604,7 +604,7 @@ func TestService_NewOrganization(t *testing.T) { }, wantStatus: http.StatusUnprocessableEntity, wantContentType: "application/json", - wantBody: `{"code":422,"message":"Name required on Chronograf Organization request body"}`, + wantBody: `{"code":422,"message":"name required on Chronograf Organization request body"}`, }, { name: "Create Organization - no user on context", diff --git a/chronograf/server/permissions.go b/chronograf/server/permissions.go index 89aad2dd2f2..3328e5993c1 100644 --- a/chronograf/server/permissions.go +++ b/chronograf/server/permissions.go @@ -24,13 +24,13 @@ func (s *Service) Permissions(w http.ResponseWriter, r *http.Request) { ts, err := s.TimeSeries(src) if err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", srcID, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } if err = ts.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", srcID, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err) Error(w, http.StatusBadRequest, msg, s.Logger) return } @@ -60,10 +60,10 @@ func validPermissions(perms *chronograf.Permissions) error { } for _, perm := range *perms { if perm.Scope != chronograf.AllScope && perm.Scope != chronograf.DBScope { - return fmt.Errorf("Invalid permission scope") + return fmt.Errorf("invalid permission scope") } if perm.Scope == chronograf.DBScope && perm.Name == "" { - return fmt.Errorf("Database scoped permission requires a name") + return fmt.Errorf("database scoped permission requires a name") } } return nil diff --git a/chronograf/server/queries.go b/chronograf/server/queries.go index 07a40ce17e8..8a48b29927d 100644 --- a/chronograf/server/queries.go +++ b/chronograf/server/queries.go @@ -115,12 +115,12 @@ func (s *Service) DefaultRP(ctx context.Context, qc *chronograf.QueryConfig, src db := s.Databases if err := db.Connect(ctx, src); err != nil { - return fmt.Errorf("Unable to connect to source: %v", err) + return fmt.Errorf("unable to connect to source: %v", err) } rps, err := db.AllRP(ctx, qc.Database) if err != nil { - return fmt.Errorf("Unable to load RPs from DB %s: %v", qc.Database, err) + return fmt.Errorf("unable to load RPs from DB %s: %v", qc.Database, err) } for _, rp := range rps { diff --git a/chronograf/server/queries_test.go b/chronograf/server/queries_test.go index a94d2605938..f4bbc4ac00f 100644 --- a/chronograf/server/queries_test.go +++ b/chronograf/server/queries_test.go @@ -33,14 +33,14 @@ func TestService_Queries(t *testing.T) { ID: "1", w: httptest.NewRecorder(), r: httptest.NewRequest("POST", "/queries", bytes.NewReader([]byte(`howdy`))), - want: `{"code":400,"message":"Unparsable JSON"}`, + want: `{"code":400,"message":"unparsable JSON"}`, }, { name: "bad id", ID: "howdy", w: httptest.NewRecorder(), r: httptest.NewRequest("POST", "/queries", bytes.NewReader([]byte{})), - want: `{"code":422,"message":"Error converting ID howdy"}`, + want: `{"code":422,"message":"error converting ID howdy"}`, }, { name: "query with no template vars", diff --git a/chronograf/server/server.go b/chronograf/server/server.go index d97238ddda6..a5627ad1576 100644 --- a/chronograf/server/server.go +++ b/chronograf/server/server.go @@ -348,7 +348,7 @@ func (s *Server) Serve(ctx context.Context) error { } if !validBasepath(s.Basepath) { - err := fmt.Errorf("Invalid basepath, must follow format \"/mybasepath\"") + err := fmt.Errorf("invalid basepath, must follow format \"/mybasepath\"") logger. WithField("component", "server"). WithField("basepath", "invalid"). diff --git a/chronograf/server/services.go b/chronograf/server/services.go index 06920b77997..02dfea94f14 100644 --- a/chronograf/server/services.go +++ b/chronograf/server/services.go @@ -40,7 +40,7 @@ func (p *postServiceRequest) Valid(defaultOrgID string) error { return fmt.Errorf("invalid source URI: %v", err) } if len(url.Scheme) == 0 { - return fmt.Errorf("Invalid URL; no URL scheme defined") + return fmt.Errorf("invalid URL; no URL scheme defined") } return nil @@ -145,7 +145,7 @@ func (s *Service) NewService(w http.ResponseWriter, r *http.Request) { } if srv, err = s.Store.Servers(ctx).Add(ctx, srv); err != nil { - msg := fmt.Errorf("Error storing service %v: %v", req, err) + msg := fmt.Errorf("error storing service %v: %v", req, err) unknownErrorWithMessage(w, msg, s.Logger) return } @@ -255,12 +255,12 @@ func (p *patchServiceRequest) Valid() error { return fmt.Errorf("invalid service URI: %v", err) } if len(url.Scheme) == 0 { - return fmt.Errorf("Invalid URL; no URL scheme defined") + return fmt.Errorf("invalid URL; no URL scheme defined") } } if p.Type != nil && *p.Type == "" { - return fmt.Errorf("Invalid type; type must not be an empty string") + return fmt.Errorf("invalid type; type must not be an empty string") } return nil diff --git a/chronograf/server/sources.go b/chronograf/server/sources.go index 80764aec1a0..8c9a3ca6931 100644 --- a/chronograf/server/sources.go +++ b/chronograf/server/sources.go @@ -141,7 +141,7 @@ func (s *Service) NewSource(w http.ResponseWriter, r *http.Request) { src.Type = dbType if src, err = s.Store.Sources(ctx).Add(ctx, src); err != nil { - msg := fmt.Errorf("Error storing source %v: %v", src, err) + msg := fmt.Errorf("error storing source %v: %v", src, err) unknownErrorWithMessage(w, msg, s.Logger) return } @@ -403,7 +403,7 @@ func ValidSourceRequest(s *chronograf.Source, defaultOrgID string) error { return fmt.Errorf("invalid source URI: %v", err) } if len(url.Scheme) == 0 { - return fmt.Errorf("Invalid URL; no URL scheme defined") + return fmt.Errorf("invalid URL; no URL scheme defined") } return nil @@ -664,13 +664,13 @@ func (s *Service) sourcesSeries(ctx context.Context, w http.ResponseWriter, r *h ts, err := s.TimeSeries(src) if err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", srcID, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err) Error(w, http.StatusBadRequest, msg, s.Logger) return 0, nil, err } if err = ts.Connect(ctx, &src); err != nil { - msg := fmt.Sprintf("Unable to connect to source %d: %v", srcID, err) + msg := fmt.Sprintf("unable to connect to source %d: %v", srcID, err) Error(w, http.StatusBadRequest, msg, s.Logger) return 0, nil, err } @@ -705,10 +705,10 @@ type sourceUserRequest struct { func (r *sourceUserRequest) ValidCreate() error { if r.Username == "" { - return fmt.Errorf("Username required") + return fmt.Errorf("username required") } if r.Password == "" { - return fmt.Errorf("Password required") + return fmt.Errorf("password required") } return validPermissions(&r.Permissions) } @@ -719,7 +719,7 @@ type sourceUsersResponse struct { func (r *sourceUserRequest) ValidUpdate() error { if r.Password == "" && r.Permissions == nil && r.Roles == nil { - return fmt.Errorf("No fields to update") + return fmt.Errorf("no fields to update") } return validPermissions(&r.Permissions) } @@ -956,11 +956,11 @@ type sourceRoleRequest struct { func (r *sourceRoleRequest) ValidCreate() error { if r.Name == "" || len(r.Name) > 254 { - return fmt.Errorf("Name is required for a role") + return fmt.Errorf("name is required for a role") } for _, user := range r.Users { if user.Name == "" { - return fmt.Errorf("Username required") + return fmt.Errorf("username required") } } return validPermissions(&r.Permissions) @@ -968,11 +968,11 @@ func (r *sourceRoleRequest) ValidCreate() error { func (r *sourceRoleRequest) ValidUpdate() error { if len(r.Name) > 254 { - return fmt.Errorf("Username too long; must be less than 254 characters") + return fmt.Errorf("username too long; must be less than 254 characters") } for _, user := range r.Users { if user.Name == "" { - return fmt.Errorf("Username required") + return fmt.Errorf("username required") } } return validPermissions(&r.Permissions) diff --git a/chronograf/server/sources_test.go b/chronograf/server/sources_test.go index 5e19ea38caf..4c4e09b488e 100644 --- a/chronograf/server/sources_test.go +++ b/chronograf/server/sources_test.go @@ -730,7 +730,7 @@ func TestService_NewSourceUser(t *testing.T) { UsersF: func(ctx context.Context) chronograf.UsersStore { return &mocks.UsersStore{ AddF: func(ctx context.Context, u *chronograf.User) (*chronograf.User, error) { - return nil, fmt.Errorf("Weight Has Nothing to Do With It") + return nil, fmt.Errorf("weight Has Nothing to Do With It") }, } }, @@ -739,7 +739,7 @@ func TestService_NewSourceUser(t *testing.T) { ID: "1", wantStatus: http.StatusBadRequest, wantContentType: "application/json", - wantBody: `{"code":400,"message":"Weight Has Nothing to Do With It"}`, + wantBody: `{"code":400,"message":"weight Has Nothing to Do With It"}`, }, { name: "Failure connecting to user store", @@ -767,14 +767,14 @@ func TestService_NewSourceUser(t *testing.T) { }, TimeSeries: &mocks.TimeSeries{ ConnectF: func(ctx context.Context, src *chronograf.Source) error { - return fmt.Errorf("Biff just happens to be my supervisor") + return fmt.Errorf("my supervisor is Biff") }, }, }, ID: "1", wantStatus: http.StatusBadRequest, wantContentType: "application/json", - wantBody: `{"code":400,"message":"Unable to connect to source 1: Biff just happens to be my supervisor"}`, + wantBody: `{"code":400,"message":"unable to connect to source 1: my supervisor is Biff"}`, }, { name: "Failure getting source", @@ -791,7 +791,7 @@ func TestService_NewSourceUser(t *testing.T) { Logger: log.New(log.DebugLevel), SourcesStore: &mocks.SourcesStore{ GetF: func(ctx context.Context, ID int) (chronograf.Source, error) { - return chronograf.Source{}, fmt.Errorf("No McFly ever amounted to anything in the history of Hill Valley") + return chronograf.Source{}, fmt.Errorf("no McFly ever amounted to anything in the history of Hill Valley") }, }, }, @@ -817,7 +817,7 @@ func TestService_NewSourceUser(t *testing.T) { ID: "BAD", wantStatus: http.StatusUnprocessableEntity, wantContentType: "application/json", - wantBody: `{"code":422,"message":"Error converting ID BAD"}`, + wantBody: `{"code":422,"message":"error converting ID BAD"}`, }, { name: "Bad name", @@ -836,7 +836,7 @@ func TestService_NewSourceUser(t *testing.T) { ID: "BAD", wantStatus: http.StatusUnprocessableEntity, wantContentType: "application/json", - wantBody: `{"code":422,"message":"Username required"}`, + wantBody: `{"code":422,"message":"username required"}`, }, { name: "Bad JSON", @@ -855,7 +855,7 @@ func TestService_NewSourceUser(t *testing.T) { ID: "BAD", wantStatus: http.StatusBadRequest, wantContentType: "application/json", - wantBody: `{"code":400,"message":"Unparsable JSON"}`, + wantBody: `{"code":400,"message":"unparsable JSON"}`, }, } for _, tt := range tests { @@ -1473,7 +1473,7 @@ func TestService_UpdateSourceUser(t *testing.T) { UID: "marty", wantStatus: http.StatusUnprocessableEntity, wantContentType: "application/json", - wantBody: `{"code":422,"message":"No fields to update"}`, + wantBody: `{"code":422,"message":"no fields to update"}`, }, } for _, tt := range tests { @@ -1545,7 +1545,7 @@ func TestService_NewSourceRole(t *testing.T) { }, wantStatus: http.StatusBadRequest, wantContentType: "application/json", - wantBody: `{"code":400,"message":"Unparsable JSON"}`, + wantBody: `{"code":400,"message":"unparsable JSON"}`, }, { name: "Invalid request", @@ -1563,7 +1563,7 @@ func TestService_NewSourceRole(t *testing.T) { ID: "1", wantStatus: http.StatusUnprocessableEntity, wantContentType: "application/json", - wantBody: `{"code":422,"message":"Name is required for a role"}`, + wantBody: `{"code":422,"message":"name is required for a role"}`, }, { name: "Invalid source ID", @@ -1581,7 +1581,7 @@ func TestService_NewSourceRole(t *testing.T) { ID: "BADROLE", wantStatus: http.StatusUnprocessableEntity, wantContentType: "application/json", - wantBody: `{"code":422,"message":"Error converting ID BADROLE"}`, + wantBody: `{"code":422,"message":"error converting ID BADROLE"}`, }, { name: "Source doesn't support roles", @@ -1653,7 +1653,7 @@ func TestService_NewSourceRole(t *testing.T) { return nil, fmt.Errorf("server had and issue") }, GetF: func(ctx context.Context, name string) (*chronograf.Role, error) { - return nil, fmt.Errorf("No such role") + return nil, fmt.Errorf("no such role") }, }, nil }, diff --git a/chronograf/server/templates.go b/chronograf/server/templates.go index 0fe8003e92e..21a38a2f317 100644 --- a/chronograf/server/templates.go +++ b/chronograf/server/templates.go @@ -14,24 +14,24 @@ import ( func ValidTemplateRequest(template *chronograf.Template) error { switch template.Type { default: - return fmt.Errorf("Unknown template type %s", template.Type) + return fmt.Errorf("unknown template type %s", template.Type) case "constant", "csv", "fieldKeys", "tagKeys", "tagValues", "measurements", "databases", "map", "influxql", "text": } for _, v := range template.Values { switch v.Type { default: - return fmt.Errorf("Unknown template variable type %s", v.Type) + return fmt.Errorf("unknown template variable type %s", v.Type) case "csv", "map", "fieldKey", "tagKey", "tagValue", "measurement", "database", "constant", "influxql": } if template.Type == "map" && v.Key == "" { - return fmt.Errorf("Templates of type 'map' require a 'key'") + return fmt.Errorf("templates of type 'map' require a 'key'") } } if template.Type == "influxql" && template.Query == nil { - return fmt.Errorf("No query set for template of type 'influxql'") + return fmt.Errorf("no query set for template of type 'influxql'") } return nil diff --git a/chronograf/server/users.go b/chronograf/server/users.go index c286610ecf9..04a717523db 100644 --- a/chronograf/server/users.go +++ b/chronograf/server/users.go @@ -24,13 +24,13 @@ type userRequest struct { func (r *userRequest) ValidCreate() error { if r.Name == "" { - return fmt.Errorf("Name required on Chronograf User request body") + return fmt.Errorf("name required on Chronograf User request body") } if r.Provider == "" { - return fmt.Errorf("Provider required on Chronograf User request body") + return fmt.Errorf("provider required on Chronograf User request body") } if r.Scheme == "" { - return fmt.Errorf("Scheme required on Chronograf User request body") + return fmt.Errorf("scheme required on Chronograf User request body") } // TODO: This Scheme value is hard-coded temporarily since we only currently @@ -42,7 +42,7 @@ func (r *userRequest) ValidCreate() error { func (r *userRequest) ValidUpdate() error { if r.Roles == nil { - return fmt.Errorf("No Roles to update") + return fmt.Errorf("no Roles to update") } return r.ValidRoles() } @@ -62,7 +62,7 @@ func (r *userRequest) ValidRoles() error { case roles.MemberRoleName, roles.ViewerRoleName, roles.EditorRoleName, roles.AdminRoleName, roles.WildcardRoleName: continue default: - return fmt.Errorf("Unknown role %s. Valid roles are 'member', 'viewer', 'editor', 'admin', and '*'", r.Name) + return fmt.Errorf("unknown role %s. Valid roles are 'member', 'viewer', 'editor', 'admin', and '*'", r.Name) } } } @@ -276,17 +276,17 @@ func (s *Service) UpdateUser(w http.ResponseWriter, r *http.Request) { // But currently, it is not possible to change name, provider, or // scheme via the API. if req.Name != "" && req.Name != u.Name { - err := fmt.Errorf("Cannot update Name") + err := fmt.Errorf("cannot update Name") invalidData(w, err, s.Logger) return } if req.Provider != "" && req.Provider != u.Provider { - err := fmt.Errorf("Cannot update Provider") + err := fmt.Errorf("cannot update Provider") invalidData(w, err, s.Logger) return } if req.Scheme != "" && req.Scheme != u.Scheme { - err := fmt.Errorf("Cannot update Scheme") + err := fmt.Errorf("cannot update Scheme") invalidData(w, err, s.Logger) return } @@ -356,7 +356,7 @@ func setSuperAdmin(ctx context.Context, req userRequest, user *chronograf.User) } else if !isSuperAdmin && (user.SuperAdmin != req.SuperAdmin) { // If req.SuperAdmin has been set, and the request was not made with the SuperAdmin // context, return error - return fmt.Errorf("User does not have authorization required to set SuperAdmin status. See https://github.com/influxdata/platform/chronograf/issues/2601 for more information.") + return fmt.Errorf("user does not have authorization required to set SuperAdmin status. See https://github.com/influxdata/platform/chronograf/issues/2601 for more information.") } return nil diff --git a/chronograf/server/users_test.go b/chronograf/server/users_test.go index d0db20571fc..635a7b17e43 100644 --- a/chronograf/server/users_test.go +++ b/chronograf/server/users_test.go @@ -61,7 +61,7 @@ func TestService_UserID(t *testing.T) { }, }, nil default: - return nil, fmt.Errorf("User with ID %d not found", *q.ID) + return nil, fmt.Errorf("user with ID %d not found", *q.ID) } }, }, @@ -354,7 +354,7 @@ func TestService_NewUser(t *testing.T) { }, wantStatus: http.StatusUnauthorized, wantContentType: "application/json", - wantBody: `{"code":401,"message":"User does not have authorization required to set SuperAdmin status. See https://github.com/influxdata/platform/chronograf/issues/2601 for more information."}`, + wantBody: `{"code":401,"message":"user does not have authorization required to set SuperAdmin status. See https://github.com/influxdata/platform/chronograf/issues/2601 for more information."}`, }, { name: "Create a new SuperAdmin User - as superadmin", @@ -600,7 +600,7 @@ func TestService_RemoveUser(t *testing.T) { Scheme: "oauth2", }, nil default: - return nil, fmt.Errorf("User with ID %d not found", *q.ID) + return nil, fmt.Errorf("user with ID %d not found", *q.ID) } }, DeleteF: func(ctx context.Context, user *chronograf.User) error { @@ -640,7 +640,7 @@ func TestService_RemoveUser(t *testing.T) { Scheme: "oauth2", }, nil default: - return nil, fmt.Errorf("User with ID %d not found", *q.ID) + return nil, fmt.Errorf("user with ID %d not found", *q.ID) } }, DeleteF: func(ctx context.Context, user *chronograf.User) error { @@ -755,7 +755,7 @@ func TestService_UpdateUser(t *testing.T) { }, }, nil default: - return nil, fmt.Errorf("User with ID %d not found", *q.ID) + return nil, fmt.Errorf("user with ID %d not found", *q.ID) } }, }, @@ -821,7 +821,7 @@ func TestService_UpdateUser(t *testing.T) { }, }, nil default: - return nil, fmt.Errorf("User with ID %d not found", *q.ID) + return nil, fmt.Errorf("user with ID %d not found", *q.ID) } }, }, @@ -895,7 +895,7 @@ func TestService_UpdateUser(t *testing.T) { }, }, nil default: - return nil, fmt.Errorf("User with ID %d not found", *q.ID) + return nil, fmt.Errorf("user with ID %d not found", *q.ID) } }, }, @@ -954,7 +954,7 @@ func TestService_UpdateUser(t *testing.T) { }, }, nil default: - return nil, fmt.Errorf("User with ID %d not found", *q.ID) + return nil, fmt.Errorf("user with ID %d not found", *q.ID) } }, }, @@ -1023,7 +1023,7 @@ func TestService_UpdateUser(t *testing.T) { }, }, nil default: - return nil, fmt.Errorf("User with ID %d not found", *q.ID) + return nil, fmt.Errorf("user with ID %d not found", *q.ID) } }, }, @@ -1089,7 +1089,7 @@ func TestService_UpdateUser(t *testing.T) { }, }, nil default: - return nil, fmt.Errorf("User with ID %d not found", *q.ID) + return nil, fmt.Errorf("user with ID %d not found", *q.ID) } }, }, @@ -1162,7 +1162,7 @@ func TestService_UpdateUser(t *testing.T) { }, }, nil default: - return nil, fmt.Errorf("User with ID %d not found", *q.ID) + return nil, fmt.Errorf("user with ID %d not found", *q.ID) } }, }, @@ -1231,7 +1231,7 @@ func TestService_UpdateUser(t *testing.T) { }, }, nil default: - return nil, fmt.Errorf("User with ID %d not found", *q.ID) + return nil, fmt.Errorf("user with ID %d not found", *q.ID) } }, }, @@ -1264,7 +1264,7 @@ func TestService_UpdateUser(t *testing.T) { id: "1336", wantStatus: http.StatusUnauthorized, wantContentType: "application/json", - wantBody: `{"code":401,"message":"User does not have authorization required to set SuperAdmin status. See https://github.com/influxdata/platform/chronograf/issues/2601 for more information."}`, + wantBody: `{"code":401,"message":"user does not have authorization required to set SuperAdmin status. See https://github.com/influxdata/platform/chronograf/issues/2601 for more information."}`, }, { name: "Update a Chronograf user to super admin - with super admin context", @@ -1300,7 +1300,7 @@ func TestService_UpdateUser(t *testing.T) { }, }, nil default: - return nil, fmt.Errorf("User with ID %d not found", *q.ID) + return nil, fmt.Errorf("user with ID %d not found", *q.ID) } }, }, @@ -1550,7 +1550,7 @@ func TestUserRequest_ValidCreate(t *testing.T) { }, }, wantErr: true, - err: fmt.Errorf("Name required on Chronograf User request body"), + err: fmt.Errorf("name required on Chronograf User request body"), }, { name: "Invalid – Provider missing", @@ -1568,7 +1568,7 @@ func TestUserRequest_ValidCreate(t *testing.T) { }, }, wantErr: true, - err: fmt.Errorf("Provider required on Chronograf User request body"), + err: fmt.Errorf("provider required on Chronograf User request body"), }, { name: "Invalid – Scheme missing", @@ -1586,7 +1586,7 @@ func TestUserRequest_ValidCreate(t *testing.T) { }, }, wantErr: true, - err: fmt.Errorf("Scheme required on Chronograf User request body"), + err: fmt.Errorf("scheme required on Chronograf User request body"), }, { name: "Invalid roles - bad role name", @@ -1605,7 +1605,7 @@ func TestUserRequest_ValidCreate(t *testing.T) { }, }, wantErr: true, - err: fmt.Errorf("Unknown role BilliettaSpecialRole. Valid roles are 'member', 'viewer', 'editor', 'admin', and '*'"), + err: fmt.Errorf("unknown role BilliettaSpecialRole. Valid roles are 'member', 'viewer', 'editor', 'admin', and '*'"), }, { name: "Invalid roles - missing organization", @@ -1676,7 +1676,7 @@ func TestUserRequest_ValidUpdate(t *testing.T) { u: &userRequest{}, }, wantErr: true, - err: fmt.Errorf("No Roles to update"), + err: fmt.Errorf("no Roles to update"), }, { name: "Invalid - bad role name", @@ -1695,7 +1695,7 @@ func TestUserRequest_ValidUpdate(t *testing.T) { }, }, wantErr: true, - err: fmt.Errorf("Unknown role BillietaSpecialOrg. Valid roles are 'member', 'viewer', 'editor', 'admin', and '*'"), + err: fmt.Errorf("unknown role BillietaSpecialOrg. Valid roles are 'member', 'viewer', 'editor', 'admin', and '*'"), }, { name: "Valid – roles empty", @@ -1727,7 +1727,7 @@ func TestUserRequest_ValidUpdate(t *testing.T) { }, }, wantErr: true, - err: fmt.Errorf("Unknown role BillietaSpecialOrg. Valid roles are 'member', 'viewer', 'editor', 'admin', and '*'"), + err: fmt.Errorf("unknown role BillietaSpecialOrg. Valid roles are 'member', 'viewer', 'editor', 'admin', and '*'"), }, { name: "Invalid - duplicate organization", diff --git a/cmd/influx/write.go b/cmd/influx/write.go index e890e989062..da0d8318fab 100644 --- a/cmd/influx/write.go +++ b/cmd/influx/write.go @@ -70,12 +70,12 @@ func fluxWriteF(cmd *cobra.Command, args []string) error { if writeFlags.Org != "" && writeFlags.OrgID != "" { cmd.Usage() - return fmt.Errorf("Please specify one of org or org-id") + return fmt.Errorf("please specify one of org or org-id") } if writeFlags.Bucket != "" && writeFlags.BucketID != "" { cmd.Usage() - return fmt.Errorf("Please specify one of bucket or bucket-id") + return fmt.Errorf("please specify one of bucket or bucket-id") } if !models.ValidPrecision(writeFlags.Precision) { diff --git a/cmd/influxd/main.go b/cmd/influxd/main.go index 697ca1ccfa3..edc96ff7ca5 100644 --- a/cmd/influxd/main.go +++ b/cmd/influxd/main.go @@ -145,7 +145,7 @@ func (m *Main) Shutdown(ctx context.Context) { func (m *Main) Run(ctx context.Context, args ...string) error { dir, err := fs.InfluxDir() if err != nil { - return fmt.Errorf("Failed to determine influx directory: %v", err) + return fmt.Errorf("failed to determine influx directory: %v", err) } prog := &cli.Program{ diff --git a/dbrp_mapping.go b/dbrp_mapping.go index 7f8fd40b8c2..7742ec8f8f3 100644 --- a/dbrp_mapping.go +++ b/dbrp_mapping.go @@ -39,19 +39,19 @@ type DBRPMapping struct { // Validate reports any validation errors for the mapping. func (m DBRPMapping) Validate() error { if !validName(m.Cluster) { - return errors.New("Cluster must contain at least one character and only be letters, numbers, '_', '-', and '.'") + return errors.New("cluster must contain at least one character and only be letters, numbers, '_', '-', and '.'") } if !validName(m.Database) { - return errors.New("Database must contain at least one character and only be letters, numbers, '_', '-', and '.'") + return errors.New("database must contain at least one character and only be letters, numbers, '_', '-', and '.'") } if !validName(m.RetentionPolicy) { - return errors.New("RetentionPolicy must contain at least one character and only be letters, numbers, '_', '-', and '.'") + return errors.New("retentionPolicy must contain at least one character and only be letters, numbers, '_', '-', and '.'") } if !m.OrganizationID.Valid() { - return errors.New("OrganizationID is required") + return errors.New("organizationID is required") } if !m.BucketID.Valid() { - return errors.New("BucketID is required") + return errors.New("bucketID is required") } return nil } diff --git a/http/influxdb/source_proxy_query_service.go b/http/influxdb/source_proxy_query_service.go index 6269d6ad627..930e6cb1589 100644 --- a/http/influxdb/source_proxy_query_service.go +++ b/http/influxdb/source_proxy_query_service.go @@ -102,7 +102,7 @@ func (s *SourceProxyQueryService) fluxQuery(ctx context.Context, w io.Writer, re func (s *SourceProxyQueryService) influxQuery(ctx context.Context, w io.Writer, req *query.ProxyRequest) (int64, error) { if len(s.URL) == 0 { - return 0, fmt.Errorf("URL from source cannot be empty if the compiler type is influxql") + return 0, fmt.Errorf("uRL from source cannot be empty if the compiler type is influxql") } u, err := newURL(s.URL, "/query") diff --git a/http/tokens.go b/http/tokens.go index 980bce7b7d2..fb67db3ca49 100644 --- a/http/tokens.go +++ b/http/tokens.go @@ -11,8 +11,8 @@ const tokenScheme = "Token " // TODO(goller): I'd like this to be Bearer // errors var ( - ErrAuthHeaderMissing = errors.New("Authorization Header is missing") - ErrAuthBadScheme = errors.New("Authorization Header Scheme is invalid") + ErrAuthHeaderMissing = errors.New("authorization Header is missing") + ErrAuthBadScheme = errors.New("authorization Header Scheme is invalid") ) // GetToken will parse the token from http Authorization Header. diff --git a/inmem/view.go b/inmem/view.go index af57ed717ae..d28fbe6c2d2 100644 --- a/inmem/view.go +++ b/inmem/view.go @@ -10,7 +10,7 @@ import ( func (s *Service) loadView(ctx context.Context, id platform.ID) (*platform.View, error) { i, ok := s.viewKV.Load(id.String()) if !ok { - return nil, fmt.Errorf("View not found") + return nil, fmt.Errorf("view not found") } d, ok := i.(*platform.View) diff --git a/models/points.go b/models/points.go index 8bc4b5e5696..a9c22ee814f 100644 --- a/models/points.go +++ b/models/points.go @@ -1378,7 +1378,7 @@ func pointKey(measurement string, tags Tags, fields Fields, t time.Time) ([]byte return nil, fmt.Errorf("+/-Inf is an unsupported value for field %s", key) } if math.IsNaN(value) { - return nil, fmt.Errorf("NaN is an unsupported value for field %s", key) + return nil, fmt.Errorf("naN is an unsupported value for field %s", key) } case float32: // Ensure the caller validates and handles invalid field values @@ -1386,7 +1386,7 @@ func pointKey(measurement string, tags Tags, fields Fields, t time.Time) ([]byte return nil, fmt.Errorf("+/-Inf is an unsupported value for field %s", key) } if math.IsNaN(float64(value)) { - return nil, fmt.Errorf("NaN is an unsupported value for field %s", key) + return nil, fmt.Errorf("naN is an unsupported value for field %s", key) } } if len(key) == 0 { diff --git a/nats/server.go b/nats/server.go index 463a4b36cff..b2b2fdb3ef2 100644 --- a/nats/server.go +++ b/nats/server.go @@ -9,7 +9,7 @@ import ( const ServerName = "platform" -var ErrNoNatsConnection = errors.New("Nats connection has not been established. Call Open() first.") +var ErrNoNatsConnection = errors.New("nats connection has not been established. Call Open() first.") // Server wraps a connection to a NATS streaming server type Server struct { diff --git a/query/influxql/group.go b/query/influxql/group.go index 0342975c1f4..70701235ee3 100644 --- a/query/influxql/group.go +++ b/query/influxql/group.go @@ -259,7 +259,7 @@ func (gr *groupInfo) createCursor(t *transpilerState) (cursor, error) { // If we do not have a function, but we have a field option, // return the appropriate error message if there is something wrong with the flux. if interval > 0 { - return nil, errors.New("GROUP BY requires at least one aggregate function") + return nil, errors.New("using GROUP BY requires at least one aggregate function") } // TODO(jsternberg): Fill needs to be somewhere and it's probably here somewhere. diff --git a/query/influxql/transpiler_test.go b/query/influxql/transpiler_test.go index a70ec73915a..ac5231f214f 100644 --- a/query/influxql/transpiler_test.go +++ b/query/influxql/transpiler_test.go @@ -241,7 +241,7 @@ func TestTranspiler_Compile(t *testing.T) { {s: `SELECT percentile(field1) FROM myseries`, err: `invalid number of arguments for percentile, expected 2, got 1`}, {s: `SELECT percentile(field1, foo) FROM myseries`, err: `expected float argument in percentile()`}, {s: `SELECT percentile(max(field1), 75) FROM myseries`, err: `expected field argument in percentile()`}, - {s: `SELECT field1 FROM foo group by time(1s)`, err: `GROUP BY requires at least one aggregate function`}, + {s: `SELECT field1 FROM foo group by time(1s)`, err: `using GROUP BY requires at least one aggregate function`}, {s: `SELECT field1 FROM foo fill(none)`, err: `fill(none) must be used with a function`}, {s: `SELECT field1 FROM foo fill(linear)`, err: `fill(linear) must be used with a function`}, {s: `SELECT count(value), value FROM foo`, err: `mixing aggregate and non-aggregate queries is not supported`}, diff --git a/query/preauthorizer.go b/query/preauthorizer.go index 33ce197a8cd..cd82f5cfb82 100644 --- a/query/preauthorizer.go +++ b/query/preauthorizer.go @@ -40,12 +40,12 @@ func (a *preAuthorizer) PreAuthorize(ctx context.Context, spec *flux.Spec, auth if err != nil { return errors.Wrapf(err, "Bucket service error") } else if bucket == nil { - return errors.New("Bucket service returned nil bucket") + return errors.New("bucket service returned nil bucket") } reqPerm := platform.ReadBucketPermission(bucket.ID) if !auth.Allowed(reqPerm) { - return errors.New("No read permission for bucket: \"" + bucket.Name + "\"") + return errors.New("no read permission for bucket: \"" + bucket.Name + "\"") } } @@ -57,7 +57,7 @@ func (a *preAuthorizer) PreAuthorize(ctx context.Context, spec *flux.Spec, auth reqPerm := platform.WriteBucketPermission(bucket.ID) if !auth.Allowed(reqPerm) { - return errors.New("No write permission for bucket: \"" + bucket.Name + "\"") + return errors.New("no write permission for bucket: \"" + bucket.Name + "\"") } } diff --git a/query/preauthorizer_test.go b/query/preauthorizer_test.go index 34067efc018..9006d1723f0 100644 --- a/query/preauthorizer_test.go +++ b/query/preauthorizer_test.go @@ -21,7 +21,7 @@ func newBucketServiceWithOneBucket(bucket platform.Bucket) platform.BucketServic return &bucket, nil } - return nil, errors.New("Unknown bucket") + return nil, errors.New("unknown bucket") } return bs diff --git a/query/promql/promql.go b/query/promql/promql.go index 14223b6fb50..463080481cf 100644 --- a/query/promql/promql.go +++ b/query/promql/promql.go @@ -3197,7 +3197,7 @@ func (p *parser) callonUnicodeClassEscape13() (interface{}, error) { } func (c *current) onUnicodeClassEscape19() (interface{}, error) { - return nil, errors.New("Unicode class not terminated") + return nil, errors.New("unicode class not terminated") } diff --git a/query/promql/promql.peg b/query/promql/promql.peg index 02f30eef013..103709e9739 100644 --- a/query/promql/promql.peg +++ b/query/promql/promql.peg @@ -107,7 +107,7 @@ UnicodeClassEscape = 'p' ( return nil, nil } / '{' IdentifierName ( ']' / EOL / EOF ) { - return nil, errors.New("Unicode class not terminated") + return nil, errors.New("unicode class not terminated") } ) diff --git a/query/promql/query.go b/query/promql/query.go index 8848daccc58..80de6cbb1ba 100644 --- a/query/promql/query.go +++ b/query/promql/query.go @@ -22,7 +22,7 @@ func Build(promql string, opts ...Option) (*flux.Spec, error) { } builder, ok := parsed.(QueryBuilder) if !ok { - return nil, fmt.Errorf("Unable to build as %t is not a QueryBuilder", parsed) + return nil, fmt.Errorf("unable to build as %t is not a QueryBuilder", parsed) } return builder.QuerySpec() } diff --git a/query/promql/types.go b/query/promql/types.go index c9cc208eed0..1790074b045 100644 --- a/query/promql/types.go +++ b/query/promql/types.go @@ -304,7 +304,7 @@ type Aggregate struct { func (a *Aggregate) QuerySpec() (*flux.Operation, error) { if a.Without { - return nil, fmt.Errorf("Unable to merge using `without`") + return nil, fmt.Errorf("unable to merge using `without`") } keys := make([]string, len(a.Labels)) for i := range a.Labels { @@ -373,7 +373,7 @@ type Operator struct { func (o *Operator) QuerySpec() (*flux.Operation, error) { switch o.Kind { case CountValuesKind, BottomKind, QuantileKind, StdVarKind: - return nil, fmt.Errorf("Unable to run %d yet", o.Kind) + return nil, fmt.Errorf("unable to run %d yet", o.Kind) case CountKind: return &flux.Operation{ ID: "count", @@ -410,7 +410,7 @@ func (o *Operator) QuerySpec() (*flux.Operation, error) { // Spec: &transformations.StddevOpSpec{}, // }, nil default: - return nil, fmt.Errorf("Unknown Op kind %d", o.Kind) + return nil, fmt.Errorf("unknown Op kind %d", o.Kind) } } @@ -479,7 +479,7 @@ type Comment struct { } func (c *Comment) QuerySpec() (*flux.Spec, error) { - return nil, fmt.Errorf("Unable to represent comments in the AST") + return nil, fmt.Errorf("unable to represent comments in the AST") } func toIfaceSlice(v interface{}) []interface{} { diff --git a/storage/reads/datatypes/predicate.pb.go b/storage/reads/datatypes/predicate.pb.go index fde63300a2e..e2f5283f787 100644 --- a/storage/reads/datatypes/predicate.pb.go +++ b/storage/reads/datatypes/predicate.pb.go @@ -373,7 +373,7 @@ func _Node_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { _ = b.EncodeVarint(uint64(x.Comparison)) case nil: default: - return fmt.Errorf("Node.Value has unexpected type %T", x) + return fmt.Errorf("node.Value has unexpected type %T", x) } return nil } diff --git a/storage/reads/datatypes/storage_common.pb.go b/storage/reads/datatypes/storage_common.pb.go index ad9b8ac5e28..792530627e6 100644 --- a/storage/reads/datatypes/storage_common.pb.go +++ b/storage/reads/datatypes/storage_common.pb.go @@ -549,7 +549,7 @@ func _ReadResponse_Frame_OneofMarshaler(msg proto.Message, b *proto.Buffer) erro } case nil: default: - return fmt.Errorf("ReadResponse_Frame.Data has unexpected type %T", x) + return fmt.Errorf("readResponse_Frame.Data has unexpected type %T", x) } return nil } diff --git a/storage/reads/predicate.go b/storage/reads/predicate.go index 0a58de3adfc..b6217014443 100644 --- a/storage/reads/predicate.go +++ b/storage/reads/predicate.go @@ -386,7 +386,7 @@ func (v *nodeToExprVisitor) Visit(n *datatypes.Node) NodeVisitor { case datatypes.NodeTypeParenExpression: if len(n.Children) != 1 { - v.err = errors.New("ParenExpression expects one child") + v.err = errors.New("parenExpression expects one child") return nil } @@ -405,7 +405,7 @@ func (v *nodeToExprVisitor) Visit(n *datatypes.Node) NodeVisitor { WalkChildren(v, n) if len(v.exprs) < 2 { - v.err = errors.New("ComparisonExpression expects two children") + v.err = errors.New("comparisonExpression expects two children") return nil } diff --git a/storage/readservice/store.go b/storage/readservice/store.go index d12581e47ab..82b8bc418f7 100644 --- a/storage/readservice/store.go +++ b/storage/readservice/store.go @@ -66,7 +66,7 @@ func (s *store) Read(ctx context.Context, req *datatypes.ReadRequest) (reads.Res func (s *store) GroupRead(ctx context.Context, req *datatypes.ReadRequest) (reads.GroupResultSet, error) { if req.SeriesLimit > 0 || req.SeriesOffset > 0 { - return nil, errors.New("GroupRead: SeriesLimit and SeriesOffset not supported when Grouping") + return nil, errors.New("groupRead: SeriesLimit and SeriesOffset not supported when Grouping") } if req.Hints.NoPoints() { diff --git a/task/backend/bolt/bolt.go b/task/backend/bolt/bolt.go index 41c78a87850..f0fa3e06b19 100644 --- a/task/backend/bolt/bolt.go +++ b/task/backend/bolt/bolt.go @@ -35,7 +35,7 @@ var ErrDBReadOnly = errors.New("db is read only") // ErrMaxConcurrency is an error for when the max concurrency is already // reached for a task when you try to schedule a task. -var ErrMaxConcurrency = errors.New("MaxConcurrency reached") +var ErrMaxConcurrency = errors.New("maxConcurrency reached") // ErrRunNotFound is an error for when a run isn't found in a FinishRun method. var ErrRunNotFound = errors.New("run not found") @@ -280,7 +280,7 @@ func (s *Store) UpdateTask(ctx context.Context, req backend.UpdateTaskRequest) ( // ListTasks lists the tasks based on a filter. func (s *Store) ListTasks(ctx context.Context, params backend.TaskSearchParams) ([]backend.StoreTaskWithMeta, error) { if params.Org.Valid() && params.User.Valid() { - return nil, errors.New("ListTasks: org and user filters are mutually exclusive") + return nil, errors.New("listTasks: org and user filters are mutually exclusive") } const ( @@ -288,10 +288,10 @@ func (s *Store) ListTasks(ctx context.Context, params backend.TaskSearchParams) maxPageSize = 500 ) if params.PageSize < 0 { - return nil, errors.New("ListTasks: PageSize must be positive") + return nil, errors.New("listTasks: PageSize must be positive") } if params.PageSize > maxPageSize { - return nil, fmt.Errorf("ListTasks: PageSize exceeds maximum of %d", maxPageSize) + return nil, fmt.Errorf("listTasks: PageSize exceeds maximum of %d", maxPageSize) } lim := params.PageSize if lim == 0 { diff --git a/task/backend/inmem_store.go b/task/backend/inmem_store.go index d8206aade1b..bb6b9aa61f0 100644 --- a/task/backend/inmem_store.go +++ b/task/backend/inmem_store.go @@ -110,7 +110,7 @@ func (s *inmem) UpdateTask(_ context.Context, req UpdateTaskRequest) (UpdateTask break } if !found { - return res, fmt.Errorf("ModifyTask: record not found for %s", idStr) + return res, fmt.Errorf("modifyTask: record not found for %s", idStr) } stm, ok := s.runners[idStr] @@ -131,7 +131,7 @@ func (s *inmem) UpdateTask(_ context.Context, req UpdateTaskRequest) (UpdateTask func (s *inmem) ListTasks(_ context.Context, params TaskSearchParams) ([]StoreTaskWithMeta, error) { if params.Org.Valid() && params.User.Valid() { - return nil, errors.New("ListTasks: org and user filters are mutually exclusive") + return nil, errors.New("listTasks: org and user filters are mutually exclusive") } const ( @@ -140,10 +140,10 @@ func (s *inmem) ListTasks(_ context.Context, params TaskSearchParams) ([]StoreTa ) if params.PageSize < 0 { - return nil, errors.New("ListTasks: PageSize must be positive") + return nil, errors.New("listTasks: PageSize must be positive") } if params.PageSize > maxPageSize { - return nil, fmt.Errorf("ListTasks: PageSize exceeds maximum of %d", maxPageSize) + return nil, fmt.Errorf("listTasks: PageSize exceeds maximum of %d", maxPageSize) } lim := params.PageSize diff --git a/task/mock/scheduler.go b/task/mock/scheduler.go index 037a23bb00c..6df57e5d259 100644 --- a/task/mock/scheduler.go +++ b/task/mock/scheduler.go @@ -199,7 +199,7 @@ func (d *DesiredState) CreateNextRun(_ context.Context, taskID platform.ID, now d.mu.Lock() defer d.mu.Unlock() if !taskID.Valid() { - return backend.RunCreation{}, errors.New("Invalid task id") + return backend.RunCreation{}, errors.New("invalid task id") } tid := taskID.String() diff --git a/testing/cells.go b/testing/cells.go index aad7ba9e173..fe199ac8899 100644 --- a/testing/cells.go +++ b/testing/cells.go @@ -444,7 +444,7 @@ func DeleteView( ID: MustIDBase16(viewThreeID), }, wants: wants{ - err: fmt.Errorf("View not found"), + err: fmt.Errorf("view not found"), views: []*platform.View{ { ViewContents: platform.ViewContents{ diff --git a/tsdb/tsm1/batch_boolean.go b/tsdb/tsm1/batch_boolean.go index 7b99390081d..bf5cebf3ee2 100644 --- a/tsdb/tsm1/batch_boolean.go +++ b/tsdb/tsm1/batch_boolean.go @@ -49,7 +49,7 @@ func BooleanArrayDecodeAll(b []byte, dst []bool) ([]bool, error) { b = b[1:] val, n := binary.Uvarint(b) if n <= 0 { - return nil, fmt.Errorf("BooleanBatchDecoder: invalid count") + return nil, fmt.Errorf("booleanBatchDecoder: invalid count") } count := int(val) diff --git a/tsdb/tsm1/batch_integer.go b/tsdb/tsm1/batch_integer.go index f93f3d94245..30af1df841f 100644 --- a/tsdb/tsm1/batch_integer.go +++ b/tsdb/tsm1/batch_integer.go @@ -167,7 +167,7 @@ func UnsignedArrayDecodeAll(b []byte, dst []uint64) ([]uint64, error) { func integerBatchDecodeAllUncompressed(b []byte, dst []int64) ([]int64, error) { b = b[1:] if len(b)&0x7 != 0 { - return []int64{}, fmt.Errorf("IntegerArrayDecodeAll: expected multiple of 8 bytes") + return []int64{}, fmt.Errorf("integerArrayDecodeAll: expected multiple of 8 bytes") } count := len(b) / 8 @@ -189,7 +189,7 @@ func integerBatchDecodeAllUncompressed(b []byte, dst []int64) ([]int64, error) { func integerBatchDecodeAllSimple(b []byte, dst []int64) ([]int64, error) { b = b[1:] if len(b) < 8 { - return []int64{}, fmt.Errorf("IntegerArrayDecodeAll: not enough data to decode packed value") + return []int64{}, fmt.Errorf("integerArrayDecodeAll: not enough data to decode packed value") } count, err := simple8b.CountBytes(b[8:]) @@ -214,7 +214,7 @@ func integerBatchDecodeAllSimple(b []byte, dst []int64) ([]int64, error) { return []int64{}, err } if n != count-1 { - return []int64{}, fmt.Errorf("IntegerArrayDecodeAll: unexpected number of values decoded; got=%d, exp=%d", n, count-1) + return []int64{}, fmt.Errorf("integerArrayDecodeAll: unexpected number of values decoded; got=%d, exp=%d", n, count-1) } // calculate prefix sum @@ -230,7 +230,7 @@ func integerBatchDecodeAllSimple(b []byte, dst []int64) ([]int64, error) { func integerBatchDecodeAllRLE(b []byte, dst []int64) ([]int64, error) { b = b[1:] if len(b) < 8 { - return []int64{}, fmt.Errorf("IntegerArrayDecodeAll: not enough data to decode RLE starting value") + return []int64{}, fmt.Errorf("integerArrayDecodeAll: not enough data to decode RLE starting value") } var k, n int @@ -242,7 +242,7 @@ func integerBatchDecodeAllRLE(b []byte, dst []int64) ([]int64, error) { // Next 1-10 bytes is the delta value value, n := binary.Uvarint(b[k:]) if n <= 0 { - return []int64{}, fmt.Errorf("IntegerArrayDecodeAll: invalid RLE delta value") + return []int64{}, fmt.Errorf("integerArrayDecodeAll: invalid RLE delta value") } k += n @@ -251,7 +251,7 @@ func integerBatchDecodeAllRLE(b []byte, dst []int64) ([]int64, error) { // Last 1-10 bytes is how many times the value repeats count, n := binary.Uvarint(b[k:]) if n <= 0 { - return []int64{}, fmt.Errorf("IntegerArrayDecodeAll: invalid RLE repeat value") + return []int64{}, fmt.Errorf("integerArrayDecodeAll: invalid RLE repeat value") } count += 1 diff --git a/tsdb/tsm1/batch_string.go b/tsdb/tsm1/batch_string.go index c9549853939..98202882739 100644 --- a/tsdb/tsm1/batch_string.go +++ b/tsdb/tsm1/batch_string.go @@ -9,9 +9,9 @@ import ( ) var ( - errStringBatchDecodeInvalidStringLength = fmt.Errorf("StringArrayDecodeAll: invalid encoded string length") - errStringBatchDecodeLengthOverflow = fmt.Errorf("StringArrayDecodeAll: length overflow") - errStringBatchDecodeShortBuffer = fmt.Errorf("StringArrayDecodeAll: short buffer") + errStringBatchDecodeInvalidStringLength = fmt.Errorf("stringArrayDecodeAll: invalid encoded string length") + errStringBatchDecodeLengthOverflow = fmt.Errorf("stringArrayDecodeAll: length overflow") + errStringBatchDecodeShortBuffer = fmt.Errorf("stringArrayDecodeAll: short buffer") ) // StringArrayEncodeAll encodes src into b, returning b and any error encountered. diff --git a/tsdb/tsm1/batch_timestamp.go b/tsdb/tsm1/batch_timestamp.go index d51a30a7e0e..faf7aad3f86 100644 --- a/tsdb/tsm1/batch_timestamp.go +++ b/tsdb/tsm1/batch_timestamp.go @@ -176,7 +176,7 @@ func TimeArrayDecodeAll(b []byte, dst []int64) ([]int64, error) { func timeBatchDecodeAllUncompressed(b []byte, dst []int64) ([]int64, error) { b = b[1:] if len(b)&0x7 != 0 { - return []int64{}, fmt.Errorf("TimeArrayDecodeAll: expected multiple of 8 bytes") + return []int64{}, fmt.Errorf("timeArrayDecodeAll: expected multiple of 8 bytes") } count := len(b) / 8 @@ -197,7 +197,7 @@ func timeBatchDecodeAllUncompressed(b []byte, dst []int64) ([]int64, error) { func timeBatchDecodeAllSimple(b []byte, dst []int64) ([]int64, error) { if len(b) < 9 { - return []int64{}, fmt.Errorf("TimeArrayDecodeAll: not enough data to decode packed timestamps") + return []int64{}, fmt.Errorf("timeArrayDecodeAll: not enough data to decode packed timestamps") } div := uint64(math.Pow10(int(b[0] & 0xF))) // multiplier @@ -224,7 +224,7 @@ func timeBatchDecodeAllSimple(b []byte, dst []int64) ([]int64, error) { return []int64{}, err } if n != count-1 { - return []int64{}, fmt.Errorf("TimeArrayDecodeAll: unexpected number of values decoded; got=%d, exp=%d", n, count-1) + return []int64{}, fmt.Errorf("timeArrayDecodeAll: unexpected number of values decoded; got=%d, exp=%d", n, count-1) } // Compute the prefix sum and scale the deltas back up @@ -247,7 +247,7 @@ func timeBatchDecodeAllSimple(b []byte, dst []int64) ([]int64, error) { func timeBatchDecodeAllRLE(b []byte, dst []int64) ([]int64, error) { if len(b) < 9 { - return []int64{}, fmt.Errorf("TimeArrayDecodeAll: not enough data to decode RLE starting value") + return []int64{}, fmt.Errorf("timeArrayDecodeAll: not enough data to decode RLE starting value") } var k, n int @@ -263,7 +263,7 @@ func timeBatchDecodeAllRLE(b []byte, dst []int64) ([]int64, error) { // Next 1-10 bytes is our (scaled down by factor of 10) run length delta delta, n := binary.Uvarint(b[k:]) if n <= 0 { - return []int64{}, fmt.Errorf("TimeArrayDecodeAll: invalid run length in decodeRLE") + return []int64{}, fmt.Errorf("timeArrayDecodeAll: invalid run length in decodeRLE") } k += n @@ -273,7 +273,7 @@ func timeBatchDecodeAllRLE(b []byte, dst []int64) ([]int64, error) { // Last 1-10 bytes is how many times the value repeats count, n := binary.Uvarint(b[k:]) if n <= 0 { - return []int64{}, fmt.Errorf("TimeDecoder: invalid repeat value in decodeRLE") + return []int64{}, fmt.Errorf("timeDecoder: invalid repeat value in decodeRLE") } if cap(dst) < int(count) { diff --git a/tsdb/tsm1/bool.go b/tsdb/tsm1/bool.go index 3ad1cbd9611..ded4ad6f6ea 100644 --- a/tsdb/tsm1/bool.go +++ b/tsdb/tsm1/bool.go @@ -119,7 +119,7 @@ func (e *BooleanDecoder) SetBytes(b []byte) { b = b[1:] count, n := binary.Uvarint(b) if n <= 0 { - e.err = fmt.Errorf("BooleanDecoder: invalid count") + e.err = fmt.Errorf("booleanDecoder: invalid count") return } diff --git a/tsdb/tsm1/int.go b/tsdb/tsm1/int.go index e13a26963b0..2d2b6d5f33f 100644 --- a/tsdb/tsm1/int.go +++ b/tsdb/tsm1/int.go @@ -240,7 +240,7 @@ func (d *IntegerDecoder) decodeRLE() { } if len(d.bytes) < 8 { - d.err = fmt.Errorf("IntegerDecoder: not enough data to decode RLE starting value") + d.err = fmt.Errorf("integerDecoder: not enough data to decode RLE starting value") return } @@ -253,7 +253,7 @@ func (d *IntegerDecoder) decodeRLE() { // Next 1-10 bytes is the delta value value, n := binary.Uvarint(d.bytes[i:]) if n <= 0 { - d.err = fmt.Errorf("IntegerDecoder: invalid RLE delta value") + d.err = fmt.Errorf("integerDecoder: invalid RLE delta value") return } i += n @@ -261,7 +261,7 @@ func (d *IntegerDecoder) decodeRLE() { // Last 1-10 bytes is how many times the value repeats count, n := binary.Uvarint(d.bytes[i:]) if n <= 0 { - d.err = fmt.Errorf("IntegerDecoder: invalid RLE repeat value") + d.err = fmt.Errorf("integerDecoder: invalid RLE repeat value") return } @@ -283,7 +283,7 @@ func (d *IntegerDecoder) decodePacked() { } if len(d.bytes) < 8 { - d.err = fmt.Errorf("IntegerDecoder: not enough data to decode packed value") + d.err = fmt.Errorf("integerDecoder: not enough data to decode packed value") return } @@ -313,7 +313,7 @@ func (d *IntegerDecoder) decodeUncompressed() { } if len(d.bytes) < 8 { - d.err = fmt.Errorf("IntegerDecoder: not enough data to decode uncompressed value") + d.err = fmt.Errorf("integerDecoder: not enough data to decode uncompressed value") return } diff --git a/tsdb/tsm1/string.go b/tsdb/tsm1/string.go index fe6b5e9b20c..7400b40a40a 100644 --- a/tsdb/tsm1/string.go +++ b/tsdb/tsm1/string.go @@ -102,7 +102,7 @@ func (e *StringDecoder) Read() string { // Read the length of the string length, n := binary.Uvarint(e.b[e.i:]) if n <= 0 { - e.err = fmt.Errorf("StringDecoder: invalid encoded string length") + e.err = fmt.Errorf("stringDecoder: invalid encoded string length") return "" } @@ -112,11 +112,11 @@ func (e *StringDecoder) Read() string { lower := e.i + n upper := lower + int(length) if upper < lower { - e.err = fmt.Errorf("StringDecoder: length overflow") + e.err = fmt.Errorf("stringDecoder: length overflow") return "" } if upper > len(e.b) { - e.err = fmt.Errorf("StringDecoder: not enough data to represent encoded string") + e.err = fmt.Errorf("stringDecoder: not enough data to represent encoded string") return "" } diff --git a/tsdb/tsm1/timestamp.go b/tsdb/tsm1/timestamp.go index 75c6ea45a04..3de58346b59 100644 --- a/tsdb/tsm1/timestamp.go +++ b/tsdb/tsm1/timestamp.go @@ -294,7 +294,7 @@ func (d *TimeDecoder) decode(b []byte) { func (d *TimeDecoder) decodePacked(b []byte) { if len(b) < 9 { - d.err = fmt.Errorf("TimeDecoder: not enough data to decode packed timestamps") + d.err = fmt.Errorf("timeDecoder: not enough data to decode packed timestamps") return } div := uint64(math.Pow10(int(b[0] & 0xF))) @@ -331,7 +331,7 @@ func (d *TimeDecoder) decodePacked(b []byte) { func (d *TimeDecoder) decodeRLE(b []byte) { if len(b) < 9 { - d.err = fmt.Errorf("TimeDecoder: not enough data for initial RLE timestamp") + d.err = fmt.Errorf("timeDecoder: not enough data for initial RLE timestamp") return } @@ -348,7 +348,7 @@ func (d *TimeDecoder) decodeRLE(b []byte) { // Next 1-10 bytes is our (scaled down by factor of 10) run length values value, n := binary.Uvarint(b[i:]) if n <= 0 { - d.err = fmt.Errorf("TimeDecoder: invalid run length in decodeRLE") + d.err = fmt.Errorf("timeDecoder: invalid run length in decodeRLE") return } @@ -359,7 +359,7 @@ func (d *TimeDecoder) decodeRLE(b []byte) { // Last 1-10 bytes is how many times the value repeats count, n := binary.Uvarint(b[i:]) if n <= 0 { - d.err = fmt.Errorf("TimeDecoder: invalid repeat value in decodeRLE") + d.err = fmt.Errorf("timeDecoder: invalid repeat value in decodeRLE") return } diff --git a/tsdb/tsm1/wal.go b/tsdb/tsm1/wal.go index 7d0ae9c7fc4..f9d7162d580 100644 --- a/tsdb/tsm1/wal.go +++ b/tsdb/tsm1/wal.go @@ -77,7 +77,7 @@ const ( var ( // ErrWALClosed is returned when attempting to write to a closed WAL file. - ErrWALClosed = fmt.Errorf("WAL closed") + ErrWALClosed = fmt.Errorf("wAL closed") // ErrWALCorrupt is returned when reading a corrupt WAL entry. ErrWALCorrupt = fmt.Errorf("corrupted WAL entry") diff --git a/view.go b/view.go index 0060b6e6f19..504d1edc380 100644 --- a/view.go +++ b/view.go @@ -7,7 +7,7 @@ import ( ) // ErrViewNotFound is the error for a missing View. -const ErrViewNotFound = ChronografError("View not found") +const ErrViewNotFound = ChronografError("view not found") // ViewService represents a service for managing View data. type ViewService interface { diff --git a/zap/tracer.go b/zap/tracer.go index d7029827423..bac009e66c5 100644 --- a/zap/tracer.go +++ b/zap/tracer.go @@ -217,7 +217,7 @@ func convertField(field log.Field) zapcore.Field { func (s *Span) LogKV(keyValues ...interface{}) { if len(keyValues)%2 != 0 { - s.LogFields(log.Error(fmt.Errorf("Non-even keyValues len: %v", len(keyValues)))) + s.LogFields(log.Error(fmt.Errorf("non-even keyValues len: %v", len(keyValues)))) return } fields, err := log.InterleavedKVToFields(keyValues...)