Merge pull request #9028 from cbushko/lint-the-c-dirs

Fix linting on cmd files
pull/9733/merge
Jonathan A. Sternberg 2018-04-23 10:41:05 -05:00 committed by GitHub
commit dff34939f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 19 deletions

View File

@ -90,7 +90,7 @@ func (c *CommandLine) Run() error {
// Check if we will be able to prompt for the password later.
if promptForPassword && !hasTTY {
return errors.New("Unable to prompt for a password with no TTY.")
return errors.New("unable to prompt for a password with no TTY")
}
// Read environment variables for username/password.
@ -166,7 +166,7 @@ func (c *CommandLine) Run() error {
i := v8.NewImporter(config)
if err := i.Import(); err != nil {
err = fmt.Errorf("ERROR: %s\n", err)
err = fmt.Errorf("ERROR: %s", err)
return err
}
return nil
@ -706,7 +706,7 @@ func (c *CommandLine) parseInto(stmt string) *client.BatchPoints {
func (c *CommandLine) parseInsert(stmt string) (*client.BatchPoints, error) {
i, point := parseNextIdentifier(stmt)
if !strings.EqualFold(i, "insert") {
return nil, fmt.Errorf("found %s, expected INSERT\n", i)
return nil, fmt.Errorf("found %s, expected INSERT", i)
}
if i, r := parseNextIdentifier(point); strings.EqualFold(i, "into") {
bp := c.parseInto(r)

View File

@ -62,7 +62,7 @@ func (cmd *Command) Run(args ...string) error {
err := cmd.isShardDir(cmd.dir)
if cmd.detailed && err != nil {
return fmt.Errorf("-detailed only supported for shard dirs.")
return fmt.Errorf("-detailed only supported for shard dirs")
}
totalSeries := newCounterFn()
@ -79,7 +79,7 @@ func (cmd *Command) Run(args ...string) error {
minTime, maxTime := int64(math.MaxInt64), int64(math.MinInt64)
var fileCount int
if err := cmd.WalkShardDirs(cmd.dir, func(db, rp, id, path string) error {
if err := cmd.walkShardDirs(cmd.dir, func(db, rp, id, path string) error {
if cmd.pattern != "" && strings.Contains(path, cmd.pattern) {
return nil
}
@ -227,7 +227,7 @@ func (cmd *Command) isShardDir(dir string) error {
return nil
}
func (cmd *Command) WalkShardDirs(root string, fn func(db, rp, id, path string) error) error {
func (cmd *Command) walkShardDirs(root string, fn func(db, rp, id, path string) error) error {
type location struct {
db, rp, id, path string
}

View File

@ -1,4 +1,4 @@
// Pacage tsdb abstracts the various shard types supported by the influx_tsm command.
// Package tsdb abstracts the various shard types supported by the influx_tsm command.
package tsdb // import "github.com/influxdata/influxdb/cmd/influx_tsm/tsdb"
import (

View File

@ -1,6 +1,5 @@
// Code generated by protoc-gen-gogo.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: internal/meta.proto
// DO NOT EDIT!
/*
Package internal is a generated protocol buffer package.

View File

@ -33,9 +33,10 @@ import (
client "github.com/influxdata/usage-client/v1"
"go.uber.org/zap"
// Initialize the engine & index packages
"github.com/influxdata/influxdb/services/storage"
// Initialize the engine package
_ "github.com/influxdata/influxdb/tsdb/engine"
// Initialize the index package
_ "github.com/influxdata/influxdb/tsdb/index"
)

View File

@ -109,20 +109,22 @@ func (cmd *Command) Run(args ...string) error {
// set defaults
if start != "" {
if t, err := parseTime(start); err != nil {
t, err := parseTime(start)
if err != nil {
return err
} else {
cmd.startTime = t
}
cmd.startTime = t
} else {
cmd.startTime = models.MinNanoTime
}
if end != "" {
if t, err := parseTime(end); err != nil {
t, err := parseTime(end)
if err != nil {
return err
} else {
cmd.endTime = t
}
cmd.endTime = t
} else {
// set end time to max if it is not set.
cmd.endTime = models.MaxNanoTime
@ -130,11 +132,11 @@ func (cmd *Command) Run(args ...string) error {
if cmd.agg != "" {
tm := proto.EnumValueMap("storage.Aggregate_AggregateType")
if agg, ok := tm[strings.ToUpper(cmd.agg)]; !ok {
agg, ok := tm[strings.ToUpper(cmd.agg)]
if !ok {
return errors.New("invalid aggregate function: " + cmd.agg)
} else {
cmd.aggType = storage.Aggregate_AggregateType(agg)
}
cmd.aggType = storage.Aggregate_AggregateType(agg)
}
if cmd.grouping != "" {