When creating a command line program in Go, is there a way (either provided by the core libraries, or a widely accepted practice) to implement a command line flag that reads its contents from a file?
If that's not clear, I'm thinking of something like the @
symbol in the command line curl
program. Many of curl's arguments allow you to do something like this to read a flag's value in from a file
# setting the value
curl --data-binary '{...}' http://example.com
# setting the value by reading from a file
curl --data-binary @path/to/data.txt http://example.com
Does go have any code for automatically implementing these sorts of flags? I've read through the official docs and didn't see anything obvious, but I'm still getting the hang of navigating those docs.
If there's nothing official, is there a de-facto standard "better flags" library provided by someone in the go community that includes this functionality?
Or is it down to an individual programmer to create a string flag, scan it for the @, and handle reading the file's contents in myself?