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

Customize -ldflags #239

Open
george012 opened this issue Apr 21, 2024 · 2 comments
Open

Customize -ldflags #239

george012 opened this issue Apr 21, 2024 · 2 comments

Comments

@george012
Copy link

george012 commented Apr 21, 2024

Customize -ldflags
For example, fyne-cross darwin -arch=arm64,amd64 -app-id com.test.test -ldflags="-X main.GoVersion=1.21.1", this usage,
I need this in my App development.

The native compilation method of golang is go build -o build_path/build_name -trimpath -ldflags "-X main.GoVersion=1.21.1" main.go

There are many custom parameters for custom -X ...

@Bluebugs
Copy link
Contributor

You should be able to use GOFLAGS for this purpose I think.

@nobe4
Copy link

nobe4 commented May 6, 2024

Confirmed, it took me a little while to figure it out, but I got the following working:

GOFLAGS="--ldflags=-X=main.version=v0.0.0" fyne-cross darwin -app-id=test.test

The main catch was whitespaces in the GOFLAG variable.
See this very informative thread.

I think adding an example in the README would be worth it :)

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