Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

process partitions after flag.Parse #1085

Merged
merged 2 commits into from
Oct 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions cmd/mt-index-cat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,6 @@ func main() {
os.Exit(-1)
}

var partitions []int32
if partitionStr != "*" {
for _, p := range strings.Split(partitionStr, ",") {
p = strings.TrimSpace(p)

// handle trailing "," on the list of partitions.
if p == "" {
continue
}

id, err := strconv.ParseInt(p, 10, 32)
if err != nil {
log.Printf("invalid partition id %q. must be a int32", p)
flag.Usage()
os.Exit(-1)
}
partitions = append(partitions, int32(id))
}
}

format := os.Args[len(os.Args)-1]
var found bool
if strings.Contains(format, "{{") {
Expand Down Expand Up @@ -203,6 +183,26 @@ func main() {
cutoffMin = now - int64(minStaleInt)
}

var partitions []int32
if partitionStr != "*" {
for _, p := range strings.Split(partitionStr, ",") {
p = strings.TrimSpace(p)

// handle trailing "," on the list of partitions.
if p == "" {
continue
}

id, err := strconv.ParseInt(p, 10, 32)
if err != nil {
log.Printf("invalid partition id %q. must be a int32", p)
flag.Usage()
os.Exit(-1)
}
partitions = append(partitions, int32(id))
}
}

var defs []schema.MetricDefinition
if len(partitions) == 0 {
defs = idx.Load(nil, uint32(cutoff))
Expand Down