Skip to content

Commit

Permalink
cmd/gomobile: always use abolute paths to replace in go.mod
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
hajimehoshi committed Jan 23, 2020
1 parent 23a0503 commit 82c397c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/gomobile/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func getModuleVersions(targetOS string, targetArch string, src string) (*modfile
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, "")
Expand Down

0 comments on commit 82c397c

Please sign in to comment.