In go, its common to set build date infomations with -ldflag=-X main.Version=v1.0.0
-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.
I tried this with CC='zig cc' CFLAGS='--target=aarch64-macos' LDFLAGS='-X main.Version=v1.0.0' so build -o main ., but it failed.
Do you plan to support that? so build could parse the LDFLAGS env (or dedicated -ldflags cli flag) and mimic the behavior, not passing down the flag to the compiler. I'm aware that C native alternative may exists, but I fell this is important to increase the compatibility with other tools in the go eco system.
In go, its common to set build date infomations with
-ldflag=-X main.Version=v1.0.0I tried this with
CC='zig cc' CFLAGS='--target=aarch64-macos' LDFLAGS='-X main.Version=v1.0.0' so build -o main ., but it failed.Do you plan to support that?
so buildcould parse theLDFLAGSenv (or dedicated -ldflags cli flag) and mimic the behavior, not passing down the flag to the compiler. I'm aware that C native alternative may exists, but I fell this is important to increase the compatibility with other tools in the go eco system.