Merge pull request #4703 from pablolmiranda/lint-cmd-influx
Complete lint for cmd/influxpull/4753/head
commit
dfe2d9539c
|
@ -260,6 +260,9 @@ func (c *CommandLine) Connect(cmd string) error {
|
|||
} else {
|
||||
c.ServerVersion = v
|
||||
}
|
||||
|
||||
_, c.ServerVersion, _ = c.Client.Ping()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ func u64tob(v uint64) []byte {
|
|||
return b
|
||||
}
|
||||
|
||||
// ShardIDs is a collection of UINT 64 that represent shard ids.
|
||||
type ShardIDs []uint64
|
||||
|
||||
func (a ShardIDs) Len() int { return len(a) }
|
||||
|
|
|
@ -49,7 +49,7 @@ func (b *blockStats) inc(typ int, enc byte) {
|
|||
for len(b.counts[typ]) <= int(enc) {
|
||||
b.counts[typ] = append(b.counts[typ], 0)
|
||||
}
|
||||
b.counts[typ][enc] += 1
|
||||
b.counts[typ][enc]++
|
||||
}
|
||||
|
||||
func (b *blockStats) size(sz int) {
|
||||
|
@ -300,7 +300,7 @@ func cmdDumpTsm1(opts *tsdmDumpOpts) {
|
|||
|
||||
// Possible corruption? Try to read as much as we can and point to the problem.
|
||||
if key == "" {
|
||||
errors = append(errors, fmt.Errorf("index pos %d, field id: %d, missing key for id.", i, block.id))
|
||||
errors = append(errors, fmt.Errorf("index pos %d, field id: %d, missing key for id", i, block.id))
|
||||
} else if len(split) < 2 {
|
||||
errors = append(errors, fmt.Errorf("index pos %d, field id: %d, key corrupt: got '%v'", i, block.id, key))
|
||||
} else {
|
||||
|
@ -382,7 +382,7 @@ func cmdDumpTsm1(opts *tsdmDumpOpts) {
|
|||
|
||||
if opts.filterKey != "" && !strings.Contains(invIds[id], opts.filterKey) {
|
||||
i += (12 + int64(length))
|
||||
blockCount += 1
|
||||
blockCount++
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,7 @@ func cmdDumpTsm1(opts *tsdmDumpOpts) {
|
|||
}, "\t"))
|
||||
|
||||
i += (12 + int64(length))
|
||||
blockCount += 1
|
||||
blockCount++
|
||||
}
|
||||
if opts.dumpBlocks {
|
||||
println("Blocks:")
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
|
||||
// These variables are populated via the Go linker.
|
||||
var (
|
||||
version string = "0.9"
|
||||
version = "0.9"
|
||||
commit string
|
||||
branch string
|
||||
buildTime string
|
||||
|
@ -169,7 +169,7 @@ func ParseCommandName(args []string) (string, []string) {
|
|||
return "", args
|
||||
}
|
||||
|
||||
// Command represents the command executed by "influxd version".
|
||||
// VersionCommand represents the command executed by "influxd version".
|
||||
type VersionCommand struct {
|
||||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
|
|
|
@ -40,6 +40,7 @@ func (cmd *Command) Run(args ...string) error {
|
|||
return cmd.Restore(config, path)
|
||||
}
|
||||
|
||||
// Restore restores a database snapshot
|
||||
func (cmd *Command) Restore(config *Config, path string) error {
|
||||
// Remove meta and data directories.
|
||||
if err := os.RemoveAll(config.Meta.Dir); err != nil {
|
||||
|
|
|
@ -102,7 +102,7 @@ func (cmd *Command) Run(args ...string) error {
|
|||
|
||||
// Validate the configuration.
|
||||
if err := config.Validate(); err != nil {
|
||||
return fmt.Errorf("%s. To generate a valid configuration file run `influxd config > influxdb.generated.conf`.", err)
|
||||
return fmt.Errorf("%s. To generate a valid configuration file run `influxd config > influxdb.generated.conf`", err)
|
||||
}
|
||||
|
||||
// Create server from config and start it.
|
||||
|
|
|
@ -127,6 +127,7 @@ func (c *Config) Validate() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ApplyEnvOverrides apply the environment configuration on top of the config.
|
||||
func (c *Config) ApplyEnvOverrides() error {
|
||||
return c.applyEnvOverrides("INFLUXDB", reflect.ValueOf(c))
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ func (cmd *PrintConfigCommand) Run(args ...string) error {
|
|||
|
||||
// Validate the configuration.
|
||||
if err := config.Validate(); err != nil {
|
||||
return fmt.Errorf("%s. To generate a valid configuration file run `influxd config > influxdb.generated.conf`.", err)
|
||||
return fmt.Errorf("%s. To generate a valid configuration file run `influxd config > influxdb.generated.conf`", err)
|
||||
}
|
||||
|
||||
toml.NewEncoder(cmd.Stdout).Encode(config)
|
||||
|
|
|
@ -30,6 +30,7 @@ import (
|
|||
"github.com/influxdb/influxdb/services/udp"
|
||||
"github.com/influxdb/influxdb/tcp"
|
||||
"github.com/influxdb/influxdb/tsdb"
|
||||
// Initialize the engine packages
|
||||
_ "github.com/influxdb/influxdb/tsdb/engine"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue