add -trimpath build flag.

Add the "-trimpath" flag from Go 1.13.

Change-Id: I10938fb5f7efd701f4025e451ddf438dc3e011ee
GitHub-Last-Rev: 4e82381342e2c13c318514800bc82af7f6ed9e1a
GitHub-Pull-Request: golang/mobile#39
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/196877
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/cmd/gomobile/bind.go b/cmd/gomobile/bind.go
index ef9a5b3..ed1874a 100644
--- a/cmd/gomobile/bind.go
+++ b/cmd/gomobile/bind.go
@@ -60,7 +60,7 @@
 
 The -v flag provides verbose output, including the list of packages built.
 
-The build flags -a, -n, -x, -gcflags, -ldflags, -tags, and -work
+The build flags -a, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work
 are shared with the build command. For documentation, see 'go help build'.
 `,
 }
diff --git a/cmd/gomobile/build.go b/cmd/gomobile/build.go
index cdc69aa..545234d 100644
--- a/cmd/gomobile/build.go
+++ b/cmd/gomobile/build.go
@@ -61,7 +61,7 @@
 
 The -v flag provides verbose output, including the list of packages built.
 
-The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, and -work are
+The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work are
 shared with the build command. For documentation, see 'go help build'.
 `,
 }
@@ -230,6 +230,7 @@
 	buildGcflags    string // -gcflags
 	buildLdflags    string // -ldflags
 	buildTarget     string // -target
+	buildTrimpath   bool   // -trimpath
 	buildWork       bool   // -work
 	buildBundleID   string // -bundleid
 	buildIOSVersion string // -iosversion
@@ -247,6 +248,7 @@
 
 	cmd.flag.BoolVar(&buildA, "a", false, "")
 	cmd.flag.BoolVar(&buildI, "i", false, "")
+	cmd.flag.BoolVar(&buildTrimpath, "trimpath", false, "")
 	cmd.flag.Var((*stringsFlag)(&ctx.BuildTags), "tags", "")
 }
 
@@ -308,6 +310,9 @@
 	if buildLdflags != "" {
 		cmd.Args = append(cmd.Args, "-ldflags", buildLdflags)
 	}
+	if buildTrimpath {
+		cmd.Args = append(cmd.Args, "-trimpath")
+	}
 	if buildWork {
 		cmd.Args = append(cmd.Args, "-work")
 	}
diff --git a/cmd/gomobile/doc.go b/cmd/gomobile/doc.go
index 5061f4c..5f86054 100644
--- a/cmd/gomobile/doc.go
+++ b/cmd/gomobile/doc.go
@@ -73,7 +73,7 @@
 
 The -v flag provides verbose output, including the list of packages built.
 
-The build flags -a, -n, -x, -gcflags, -ldflags, -tags, and -work
+The build flags -a, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work
 are shared with the build command. For documentation, see 'go help build'.
 
 
@@ -117,7 +117,7 @@
 
 The -v flag provides verbose output, including the list of packages built.
 
-The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, and -work are
+The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work are
 shared with the build command. For documentation, see 'go help build'.
 
 
@@ -152,7 +152,7 @@
 
 Only -target android is supported. The 'adb' tool must be on the PATH.
 
-The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, and -work are
+The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work are
 shared with the build command.
 For documentation, see 'go help build'.
 
diff --git a/cmd/gomobile/install.go b/cmd/gomobile/install.go
index 522bd3d..86edaed 100644
--- a/cmd/gomobile/install.go
+++ b/cmd/gomobile/install.go
@@ -23,7 +23,7 @@
 
 Only -target android is supported. The 'adb' tool must be on the PATH.
 
-The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, and -work are
+The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work are
 shared with the build command.
 For documentation, see 'go help build'.
 `,