x/mobile: iOS bind clobbers existing build tags #18523
Closed
Comments
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
gomobile bind
for iOS adds a-tags ios
argument that clobbers any user-supplied-tags
.What version of Go are you using (
go version
)?go1.7.4
What operating system and processor architecture are you using (
go env
)?darwin/amd64
What did you do?
Reproduction scenario:
First, modify the bind iOS example code (golang.org/x/mobile/example/bind/hello) to require the presence of a build tag. Like so:
Attempting to
gomobile bind
now without the build tag fails as expected.However, providing the tag still fails, although at a later point in the build:
Notice the problem: There are two
-tags
arguments. The first is the one we supplied, and the second -- which clobbers the first -- is added by the iOSbind
code.The fix for the problem is this:
NOTE: This is imperfect. It results in the
ios
tag get added multiple times for a large build. But that still functions correctly, whereas the current code does not. A proper fix should probably check for the presence of theios
tag before re-adding it.After rebuilding
gomobile
, we get this:You can see that the
-tags
argument is better, but incorrect. This is due to issue #18515. If we apply the fix for that, we get:Note that the
-tags
argument is correct and works as expected. (However, later on in the output you'll see-tags aaa ios ios ios
and so on.)Impact
We discovered this the hard way and had to hack around it by patching gomobile before building it. This can be seen here.
The text was updated successfully, but these errors were encountered: