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

--help should not panic & other argument-passing interrogations #9

Open
drzraf opened this issue May 27, 2020 · 1 comment
Open

--help should not panic & other argument-passing interrogations #9

drzraf opened this issue May 27, 2020 · 1 comment

Comments

@drzraf
Copy link

drzraf commented May 27, 2020

$ go version
go version go1.13.8 linux/amd64

$ cd ./go/bin/ && ./SystemdJournal2Gelf --help 
panic: usage: SystemdJournal2Gelf SERVER:12201 [JOURNALCTL PARAMETERS]

goroutine 1 [running]:
main.main()
	~/go/src/github.com/parse-nl/SystemdJournal2Gelf/SystemdJournal2Gelf.go:164 +0x64d


$ ./SystemdJournal2Gelf localhost:12201 -- --version
Failed to add match '--version': Invalid argument
# ^^ I would expect it to be passed to journald...


$ ./SystemdJournal2Gelf localhost:12201 --version
panic: could not parse journal output: invalid character 's' looking for beginning of value
# ^^ Why?
@drzraf drzraf changed the title --help should not panic --help should not panic & other argument-passing interrogations May 27, 2020
@SjonHortensius
Copy link
Member

I see your point but all of these issues can be explained:

  • --help panics because I used panic instead of fmt.Printf + os.Exit (I can fix this and you'd get the same error without the backtrace) I understand this might seem as if something went wrong

  • -- --version comes from journalctl: see journalctl -- --version. I see your point here as well as -- would normally be used as the option vs filter separator, but it currently isn't in this script

  • --version fails because this script expects JSON output. --version outputs non-json data which it cannot parse

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

2 participants