Hack around broken bazel golang build rules.
This commit is contained in:
34
BUILD
34
BUILD
@ -7,30 +7,30 @@ package(
|
|||||||
go_prefix("github.com/laramiel/bazel-example-golang/")
|
go_prefix("github.com/laramiel/bazel-example-golang/")
|
||||||
|
|
||||||
go_binary(
|
go_binary(
|
||||||
name ="hello",
|
name = "hello",
|
||||||
srcs = [ "hello.go" ],
|
srcs = ["hello.go"],
|
||||||
)
|
)
|
||||||
|
|
||||||
go_binary(
|
go_binary(
|
||||||
name ="local",
|
name = "local",
|
||||||
srcs = [ "local.go" ],
|
srcs = ["local.go"],
|
||||||
deps = [
|
deps = [
|
||||||
"//local",
|
"//local",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
go_binary(
|
go_binary(
|
||||||
name ="remote",
|
name = "remote",
|
||||||
srcs = [ "remote.go" ],
|
srcs = ["remote.go"],
|
||||||
deps = [
|
deps = [
|
||||||
"@remote//:remote",
|
"@ws_remote//:remote",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
go_binary(
|
go_binary(
|
||||||
name ="bare",
|
name = "bare",
|
||||||
srcs = [ "bare.go" ],
|
srcs = ["bare.go"],
|
||||||
deps = [
|
deps = [
|
||||||
"@bare//:bare",
|
"@ws_bare//:bare",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -3,7 +3,7 @@ load("@bazel_tools//tools/build_rules/go:def.bzl", "go_repositories")
|
|||||||
go_repositories()
|
go_repositories()
|
||||||
|
|
||||||
git_repository(
|
git_repository(
|
||||||
name = "remote",
|
name = "ws_remote",
|
||||||
remote = "https://github.com/laramiel/bazel-example-golang-remote.git",
|
remote = "https://github.com/laramiel/bazel-example-golang-remote.git",
|
||||||
commit = "8f2e405",
|
commit = "8f2e405",
|
||||||
)
|
)
|
||||||
@ -23,7 +23,7 @@ go_library(
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
new_git_repository(
|
new_git_repository(
|
||||||
name = "bare",
|
name = "ws_bare",
|
||||||
remote = "https://github.com/laramiel/bazel-example-golang-bare.git",
|
remote = "https://github.com/laramiel/bazel-example-golang-bare.git",
|
||||||
commit = "3bd848f",
|
commit = "3bd848f",
|
||||||
build_file_content = BARE_BUILD
|
build_file_content = BARE_BUILD
|
||||||
|
8
bare.go
8
bare.go
@ -2,7 +2,13 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/laramiel/bazel-example-golang-bare/bare"
|
|
||||||
|
// HACK ALERT
|
||||||
|
// The correct import is this:
|
||||||
|
// "github.com/laramiel/bazel-example-golang-bare/bare"
|
||||||
|
// But the bazel build rules for external golang packages like git_repository() are busted.
|
||||||
|
// We hack around it by importing where those external dependencies end up:
|
||||||
|
"github.com/laramiel/bazel-example-golang/external/ws_bare/bare"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -2,7 +2,13 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/laramiel/bazel-example-golang-remote/remote"
|
|
||||||
|
// HACK ALERT
|
||||||
|
// The correct import is this:
|
||||||
|
// "github.com/laramiel/bazel-example-golang-remote/remote"
|
||||||
|
// But the bazel build rules for external golang packages like git_repository() are busted.
|
||||||
|
// We hack around it by importing where those external dependencies end up:
|
||||||
|
"github.com/laramiel/bazel-example-golang/external/ws_remote/remote"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -2,7 +2,14 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/laramiel/bazel-example-golang-bare/bare"
|
|
||||||
|
// HACK ALERT
|
||||||
|
// The correct import is this:
|
||||||
|
// "github.com/laramiel/bazel-example-golang-bare/bare"
|
||||||
|
// But the bazel build rules for subversion packages don't support alternate
|
||||||
|
// go_prefix() commands.
|
||||||
|
// We hack around it by importing where those external dependencies end up:
|
||||||
|
"github.com/laramiel/bazel-example-golang/submodule/src/bare"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -2,7 +2,14 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/laramiel/bazel-example-golang-remote/remote"
|
|
||||||
|
// HACK ALERT
|
||||||
|
// The correct import is this:
|
||||||
|
// "github.com/laramiel/bazel-example-golang-bare/bare"
|
||||||
|
// But the bazel build rules for subversion packages don't support alternate
|
||||||
|
// go_prefix() commands.
|
||||||
|
// We hack around it by importing where those external dependencies end up:
|
||||||
|
"github.com/laramiel/bazel-example-golang/submodule/src/remote/remote"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
Reference in New Issue
Block a user