Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot use tinygo build -ldflags "-X 'main.WASM_NAME=ws_conn.wasm'" to modify variable WASM_NAME #4328

Closed
longkui-clown opened this issue Jul 8, 2024 · 3 comments

Comments

@longkui-clown
Copy link

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?
image
image

@Tush-r
Copy link

Tush-r commented Aug 26, 2024

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

@longkui-clown
Copy link
Author

thanks,i got it

@deadprogram
Copy link
Member

Closing since the question was answered. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants