tinygo/compileopts
Ayke van Laethem 33f76d1c2e main: implement -ldflags="-X ..."
This commit implements replacing some global variables with a different
value, if the global variable has no initializer. For example, if you
have:

    package main

    var version string

you can replace the value with -ldflags="-X main.version=0.2".

Right now it only works for uninitialized globals. The Go tooling also
supports initialized globals (var version = "<undefined>") but that is a
bit hard to combine with how initialized globals are currently
implemented.

The current implementation still allows caching package IR files while
making sure the values don't end up in the build cache. This means
compiling a program multiple times with different values will use the
cached package each time, inserting the string value only late in the
build process.

Fixes #1045
2021-04-09 18:33:48 +02:00
..
config.go main: remove -cflags and -ldflags flags 2021-04-09 18:33:48 +02:00
options.go main: implement -ldflags="-X ..." 2021-04-09 18:33:48 +02:00
options_test.go compileopts: improve error reporting of unsupported flags 2020-05-16 23:29:47 +02:00
target.go throw an error on windows builds with no target specified 2021-03-29 09:35:19 +02:00
target_test.go compileopts: simplify copyProperties using reflection 2020-09-20 13:49:16 +02:00