Respect package boundaries in bp2build conversion of go modules

bp2build's codegen context does not implement
BazelPathConversionContext. To reuse the utility function
transformPackagePaths, update its signature

(Also make deps of go_library unique to make the conversion resilient)

Test: go test ./bp2build
Change-Id: I126b1057d2b26bc6c7d3be2780f1b62d28323cf0
diff --git a/bp2build/go_conversion_test.go b/bp2build/go_conversion_test.go
index a872fc7..507fbf0 100644
--- a/bp2build/go_conversion_test.go
+++ b/bp2build/go_conversion_test.go
@@ -75,11 +75,11 @@
 				"deps":       `["//bar:bar"]`,
 				"importpath": `"android/foo"`,
 				"srcs": `[
-        ":foo1.go",
-        ":foo2.go",
+        "foo1.go",
+        "foo2.go",
     ] + select({
-        "//build/bazel/platforms/os:darwin": [":foo_darwin.go"],
-        "//build/bazel/platforms/os:linux_glibc": [":foo_linux.go"],
+        "//build/bazel/platforms/os:darwin": ["foo_darwin.go"],
+        "//build/bazel/platforms/os:linux_glibc": ["foo_linux.go"],
         "//conditions:default": [],
     })`,
 			},
@@ -118,7 +118,31 @@
         "//bar:bar",
         "//bar:baz",
     ]`,
-				"srcs": `[":main.go"]`,
+				"srcs": `["main.go"]`,
+			},
+			android.HostSupported,
+		)},
+	})
+}
+
+func TestConvertGoBinaryWithSrcInDifferentPackage(t *testing.T) {
+	bp := `
+blueprint_go_binary {
+	name: "foo",
+	srcs: ["subdir/main.go"],
+}
+`
+	t.Parallel()
+	runGoTests(t, Bp2buildTestCase{
+		Description: "Convert blueprint_go_binary with src in different package",
+		Blueprint:   bp,
+		Filesystem: map[string]string{
+			"subdir/Android.bp": "",
+		},
+		ExpectedBazelTargets: []string{makeBazelTargetHostOrDevice("go_binary", "foo",
+			AttrNameToString{
+				"deps": `[]`,
+				"srcs": `["//subdir:main.go"]`,
 			},
 			android.HostSupported,
 		)},