I'm writing a command line program in go, and it needs to access some predefined external files like /usr/lib/name/file. What would be a good way to allow specify the constant path in compile time?
I see two options: 1. go generate 2. -ldflags="-X 'main.Path=..." Both seem to be flawed. For #1, the blog clearly stated that it's designed for package author, and not for clients (and go generate doesn't support passing arguments to //go:generate anyways). For #2, the path can't be a constant. Is there a convention on how this problem should be solved or external paths should always be passed in as arguments in go? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/e5029b93-a3d9-4256-ab1c-a83d3b35c579n%40googlegroups.com.