Hi there,
My problem is go run someprogram.go usecomand change_variable=value
is this possible and how I can make it?
Try reading this - https://github.com/golang/go/wiki/GcToolchainTricks#including-build-information-in-the-executable
1 Like
But the problem is how I can write that? Do you have any example?
Just use flag
https://golang.org/pkg/flag/#example_
var intervalFlag interval
func init() {
// Tie the command-line flag to the intervalFlag variable and
// set a usage message.
flag.Var(&intervalFlag, "deltaT", "comma-separated list of intervals to use between events")
}
func main() {
// All the interesting pieces are with the variables declared above, but
// to enable the flag package to see the flags defined there, one must
// execute, typically at the start of main (not init!):
flag.Parse()
// We don't run it here because this is not a main function and
// the testing suite has already parsed the flags.
}
Thank you for your answer, but it still don’t work
Then please tell us more detailed what your problem is and what you want to achieve.
Perhaps even show us what you have tried already?
1 Like
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.