Skip to content

Bug: Listing parameters when you have 0 panics, index out of bounds #491

Closed
@Emyrk

Description

@Emyrk

Summary

When you do parameters list with 0 parameters, you get a panic.

$ ./coder parameters list
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/coder/coder/cli.parameterList.func1(0xc000259b80, {0xecfa7f0, 0x0, 0x0})
	/home/runner/work/coder/coder/cli/parameterlist.go:28 +0x6e5
github.com/spf13/cobra.(*Command).execute(0xc000259b80, {0xecfa7f0, 0x0, 0x0})
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:856 +0x60e
github.com/spf13/cobra.(*Command).ExecuteC(0xc00013ea00)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
main.main()
	/home/runner/work/coder/coder/cmd/coder/main.go:10 +0x1e
steven ~/Downloads/example $                                         

Current Behavior (steps to reproduce)

A index out of bounds panic.

  1. Start a new dev server ./coder start --dev
  2. List params ./coder parameters list

Desired Behavior

Return an empty list

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions