tinygo
tinygo copied to clipboard
cannot use `tinygo build -ldflags "-X 'main.WASM_NAME=ws_conn.wasm'"` to modify variable WASM_NAME
trafficstars
when i use cmd tinygo build -ldflags "-X 'main.WASM_NAME=ws_conn.wasm'" to change the variable WASM_NAME in main package like golang, i got the return val in default val, is it not work?
The documentation mentions that if a default value is set for a variable, value passed with ldflags will be ignored.
One important thing to note is that you cannot use a default value in your code if you want to be able to set that value using -ldflags. If you set the variable to a default value, then the value you pass using ldflags will be ignored.
Source: How to set build-time variables
thanks,i got it
Closing since the question was answered. Thank you!