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

x/mobile/cmd/gomobile: build tags are ignored in a certain situation #16062

Closed
hajimehoshi opened this issue Jun 14, 2016 · 4 comments
Closed
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Milestone

Comments

@hajimehoshi
Copy link
Member

hajimehoshi commented Jun 14, 2016

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.6.2 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/hajimehoshi/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

What did you do?

foo.go

package foo

import (
    _ "/path/to/package/bar"
)

func foo() {
}

bar.go (in /path/to/package/bar)

// any slash slash comment
// +build ignore
This text won't affect compiling, right?

Tried gomobile bind -target ios for foo.go but failed like:

gomobile: go install -p=4 -pkgdir=/Users/hajimehoshi/go/pkg/gomobile/pkg_darwin_arm -tags="" github.com/hajimehoshi/go-ios-test failed: exit status 1
foo.go:4:2: 
internal/bar/bar.go:3:1: expected 'package', found 'IDENT' This

It seems like a slash-slash comment prevents from interpreting build tags in dependent libraries. gomobile bind -target android worked well BTW.

@hajimehoshi
Copy link
Member Author

The syntax checking might be expected, but it looks like imports are checked: if a lib imported at bar.go is not available on iOS, gomobile bind -target ios causes an error. Is this expected?

@hajimehoshi
Copy link
Member Author

The syntax checking might be expected, but it looks like imports are checked: if a lib imported at bar.go is not available on iOS, gomobile bind -target ios causes an error. Is this expected?

Oops, I found this (unexpected lib importing) was my mistake. Please ignore this.

@quentinmit quentinmit added this to the Unreleased milestone Jun 17, 2016
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Jul 20, 2017
@hajimehoshi
Copy link
Member Author

Has this been solved?

@eliasnaur
Copy link
Contributor

Sorry, I misread your "Please ignore this." to mean the entire issue.

However, I think this issue should stay closed, because the problem is not gomobile. If you run go install /path/to/foo, you will get the same error:

../../../github.com/petejkim/foo/foo.go:4:2: 
../../../path/to/package/bar/bar.go:3:1: expected 'package', found 'IDENT' This
../../../path/to/package/bar/bar.go:3:14: rune literal not terminated

gomobile can't bind invalid Go code.

@golang golang locked and limited conversation to collaborators Mar 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

4 participants