commit | 2b26a4705d2481ef30846d291bd450445e2b5bdd | [log] [tgz] |
---|---|---|
author | Hana Kim <hyangah@gmail.com> | Wed Feb 05 18:37:23 2020 -0500 |
committer | Hyang-Ah Hana Kim <hyangah@gmail.com> | Wed Feb 12 15:27:14 2020 +0000 |
tree | bbf94a361e9755eac1a0762965e3e187c53700c7 | |
parent | 0df4eb2385467a487d418c6358313e9e838256ae [diff] |
cmd/gomobile: handle modules replaced by other versioned modules Previously, gomobile bind's go.mod generation logic assumed replacing module was always located in the disk, but is not always true. It's valid to replace a module(version) with another module&version. For example, replace golang.org/x/tools => ../ causes: { "Path": "golang.org/x/tools", "Version": "v0.0.0-20191017151554-a3bc800455d5", "Replace": { "Path": "../", "Dir": "/usr/local/google/home/hakim/go/src/golang.org/x/tools", "GoMod": "/usr/local/google/home/hakim/go/src/golang.org/x/tools/go.mod", "GoVersion": "1.11" }, "Dir": "/usr/local/google/home/hakim/go/src/golang.org/x/tools", "GoMod": "/usr/local/google/home/hakim/go/src/golang.org/x/tools/go.mod", "GoVersion": "1.11" } replace github.com/anacrolix/torrent v1.13.0 => gitlab.com/axet/torrent v0.0.0-20200205141541-92b4b9e7387e causes: { "Path": "github.com/anacrolix/torrent", "Version": "v1.13.0", "Replace": { "Path": "gitlab.com/axet/torrent", "Version": "v0.0.0-20200205141541-92b4b9e7387e", "Time": "2020-02-05T14:15:41Z", "Dir": "/usr/local/google/home/hakim/go/pkg/mod/gitlab.com/axet/torrent@v0.0.0-20200205141541-92b4b9e7387e", "GoMod": "/usr/local/google/home/hakim/go/pkg/mod/cache/download/gitlab.com/axet/torrent/@v/v0.0.0-20200205141541-92b4b9e7387e.mod" }, "Dir": "/usr/local/google/home/hakim/go/pkg/mod/gitlab.com/axet/torrent@v0.0.0-20200205141541-92b4b9e7387e", "GoMod": "/usr/local/google/home/hakim/go/pkg/mod/cache/download/gitlab.com/axet/torrent/@v/v0.0.0-20200205141541-92b4b9e7387e.mod" } Also, while we are here, trim down the entries added to the generated go.mod. We need the main module, and the replaced module info. We may want to pin golang.org/x/mobile version if possible, but I don't know a reliable way to achieve that yet. Fixes golang/go#37048 Change-Id: Ibd7332338c0a3c4165a642c3e86852061f6ab13b Reviewed-on: https://go-review.googlesource.com/c/mobile/+/218057 Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
The Go mobile repository holds packages and build tools for using Go on mobile platforms.
Package documentation as a starting point:
The Go Mobile project is experimental. Use this at your own risk. While we are working hard to improve it, neither Google nor the Go team can provide end-user support.
This is early work and installing the build system requires Go 1.5. Follow the instructions on golang.org/wiki/Mobile to install the gomobile command, build the basic and the bind example apps.
Contributions to Go are appreciated. See https://golang.org/doc/contribute.html.