The go tool link command has a -X option (see go doc cmd/link):
-X importpath.name=value
Set the value of the string variable in importpath named name to value.
This is only effective if the variable is declared in the
source code either uninitialized
or initialized to a constant string expression. -X will not
work if the initializer makes
a function call or refers to other variables.
Note that before Go 1.5 this option took two separate arguments.
In a spec file using -linkmode=external is there an equivalent option
to -X above?
An upstream project uses -X in their makefile to set the Version
string to a value other than "unknown". One option that works for a
spec file is to just use sed to set the Version string to the desired
value but I was wondering if there was an equivalent linker flag that
can be used that will replicate -X above.
thanks
Brad
Show replies by date