cmd/gomobile: always use abolute paths to replace in go.mod
A replative path in go.mod works only in the directory of the
go.mod. When creating go.mod for gobind, copying relative paths
did not work since go.mod is in a different temporary directory.
This CL fixes the issue to use Dir, which is an absolute path to
the module, instead of Path.
Updates golang/go#27234
Change-Id: Ib009ec508aa3ce3d092af14f921a57192feaac61
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/215421
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/cmd/gomobile/bind.go b/cmd/gomobile/bind.go
index 741f72c..d29d062 100644
--- a/cmd/gomobile/bind.go
+++ b/cmd/gomobile/bind.go
@@ -263,7 +263,7 @@
if mod != nil {
switch {
case mod.Replace != nil:
- f.AddReplace(mod.Path, mod.Version, mod.Replace.Path, mod.Replace.Version)
+ f.AddReplace(mod.Path, mod.Version, mod.Replace.Dir, mod.Replace.Version)
case mod.Version == "":
// When the version part is empty, the module is local and mod.Dir represents the location.
f.AddReplace(mod.Path, "", mod.Dir, "")