Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining a command without cmd or valid imports defined causes panic #50

Closed
frankcarey opened this issue Jan 21, 2017 · 1 comment
Closed

Comments

@frankcarey
Copy link
Contributor

frankcarey commented Jan 21, 2017

This should fail more gracefully with a helpful error message.

Example files:

version: v2
commands:
  example:
    usage: This doesn't have a command defined.
version: v2
commands:
  example:
    usage: 'cmd' is misspelled as 'dmc'
    dmc: echo "test"
version: v2
commands:
  example:
    usage: This doesn't have an import where the file actually exists.
    imports:
      - file-not-exists.yml
version: v2
commands:
  example:
    usage: This has 'imports' misspelled as 'import'
    import:
      - import-exists.yml

Panic Error

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x74918]

goroutine 1 [running]:
panic(0x17d220, 0xc4200120b0)
	/usr/local/Cellar/go/1.7.3/libexec/src/runtime/panic.go:500 +0x1a1
github.com/ahoy-cli/ahoy/vendor/github.com/codegangsta/cli.Command.Run(0xc4200705a0, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc4200705c0, 0xf, 0x0, ...)
	/private/tmp/ahoy-20161121-46993-73ob16/src/github.com/ahoy-cli/ahoy/vendor/github.com/codegangsta/cli/command.go:131 +0x798
github.com/ahoy-cli/ahoy/vendor/github.com/codegangsta/cli.(*App).Run(0xc42009e120, 0xc420084060, 0x2, 0x2, 0x0, 0x0)
	/private/tmp/ahoy-20161121-46993-73ob16/src/github.com/ahoy-cli/ahoy/vendor/github.com/codegangsta/cli/app.go:175 +0xa35
main.main()
	/private/tmp/ahoy-20161121-46993-73ob16/src/github.com/ahoy-cli/ahoy/ahoy.go:379 +0xea

frankcarey pushed a commit that referenced this issue Jan 22, 2017
frankcarey pushed a commit that referenced this issue Jan 22, 2017
frankcarey pushed a commit that referenced this issue Jan 22, 2017
frankcarey pushed a commit that referenced this issue Jan 22, 2017
frankcarey pushed a commit that referenced this issue Jan 22, 2017
* The were using yaml.Marshall of the config which ends up setting both cmd and imports.
frankcarey pushed a commit that referenced this issue Jan 22, 2017
Issue #50: Add a (failing) test that demonstrates the panic when a co…
@frankcarey
Copy link
Contributor Author

This now has errors and tests specific to each case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant