mikeflynn / go-alexa

A collection of Amazon Echo / Alexa tools for Go development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please avoid parsing command line flags

rhuss opened this issue · comments

If I understood correctly, the skillserver is meant to be run as a library. A library should never parse command line options, as it never knows in which context it is used. E.g. when embedded in another application this interfers with command liner parsing done by the caller itself.

I refer to this initialization:

flag.BoolVar(&insecureSkipVerify, "insecure-skip-verify", false, "Skip certificate checks for downloading from AWS")
flag.Parse()

Instead of parsing a command line flag here, the Run method should get the information whether to verify SSL certificates as argument to the method.

Originally it was written to be run as the server itself which is why it had command line flags. Obviously there would be no reason for CLI flags if it was only a library, but the more common use case is now is as a library.

I agree on with the idea (though the reason this hasn't come up before is that you really shouldn't skip the verification) for the skip verification, but I left some notes on the PR.