Skip to content

Commit 5ba0542

Browse files
committed
Fix panic when running 'axiom ingest' without dataset argument
1 parent 1d124f1 commit 5ba0542

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

cmd/axiom/ingest/ingest.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func NewIngestCmd(f *cmdutil.Factory) *cobra.Command {
4949
}
5050

5151
cmd := &cobra.Command{
52-
Use: "ingest <dataset-name> [(-f|--file) <filename> [ ...]] [--timestamp-field <timestamp-field>] [--timestamp-format <timestamp-format>] [--flush-every <duration>] [(-c|--compression=)TRUE|FALSE]",
52+
Use: "ingest <dataset-name> [(-f|--file) <filename> [ ...]] [--timestamp-field <timestamp-field>] [--timestamp-format <timestamp-format>] [--flush-every <duration>]",
5353
Short: "Ingest data",
5454
Long: heredoc.Doc(`
5555
Ingest data into an Axiom dataset.
@@ -83,10 +83,6 @@ func NewIngestCmd(f *cmdutil.Factory) *cobra.Command {
8383
# "nginx-logs":
8484
$ axiom ingest nginx-logs -f nginx-logs.json
8585
86-
# Ingest the contents of all files inside /var/logs/nginx with
87-
# extension ".log" into a dataset named "nginx-logs":
88-
$ axiom ingest nginx-logs -f /var/logs/nginx/*.log
89-
9086
# Pipe the contents of a log generator into a dataset named
9187
# "gen-logs". If the length of the data stream is unknown, the
9288
# "--flush-every" flag can be tweaked to optimize shipping the data
@@ -146,7 +142,7 @@ func complete(ctx context.Context, opts *options) error {
146142

147143
// Just fetch a list of available datasets if a Personal Access Token is
148144
// used.
149-
datasetNames := make([]string, 0)
145+
var datasetNames []string
150146
if dep, ok := opts.Config.GetActiveDeployment(); ok && client.IsPersonalToken(dep.Token) {
151147
client, err := opts.Client()
152148
if err != nil {
@@ -163,6 +159,7 @@ func complete(ctx context.Context, opts *options) error {
163159

164160
stop()
165161

162+
datasetNames = make([]string, len(datasets))
166163
for i, dataset := range datasets {
167164
datasetNames[i] = dataset.Name
168165
}

0 commit comments

Comments
 (0)