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_binary(
|
||||
name ="hello",
|
||||
srcs = [ "hello.go" ],
|
||||
name = "hello",
|
||||
srcs = ["hello.go"],
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name ="local",
|
||||
srcs = [ "local.go" ],
|
||||
deps = [
|
||||
"//local",
|
||||
],
|
||||
name = "local",
|
||||
srcs = ["local.go"],
|
||||
deps = [
|
||||
"//local",
|
||||
],
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name ="remote",
|
||||
srcs = [ "remote.go" ],
|
||||
deps = [
|
||||
"@remote//:remote",
|
||||
],
|
||||
name = "remote",
|
||||
srcs = ["remote.go"],
|
||||
deps = [
|
||||
"@ws_remote//:remote",
|
||||
],
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name ="bare",
|
||||
srcs = [ "bare.go" ],
|
||||
deps = [
|
||||
"@bare//:bare",
|
||||
],
|
||||
name = "bare",
|
||||
srcs = ["bare.go"],
|
||||
deps = [
|
||||
"@ws_bare//:bare",
|
||||
],
|
||||
)
|
||||
|
@ -3,7 +3,7 @@ load("@bazel_tools//tools/build_rules/go:def.bzl", "go_repositories")
|
||||
go_repositories()
|
||||
|
||||
git_repository(
|
||||
name = "remote",
|
||||
name = "ws_remote",
|
||||
remote = "https://github.com/laramiel/bazel-example-golang-remote.git",
|
||||
commit = "8f2e405",
|
||||
)
|
||||
@ -23,7 +23,7 @@ go_library(
|
||||
"""
|
||||
|
||||
new_git_repository(
|
||||
name = "bare",
|
||||
name = "ws_bare",
|
||||
remote = "https://github.com/laramiel/bazel-example-golang-bare.git",
|
||||
commit = "3bd848f",
|
||||
build_file_content = BARE_BUILD
|
||||
|
10
bare.go
10
bare.go
@ -1,8 +1,14 @@
|
||||
package main
|
||||
package main
|
||||
|
||||
import (
|
||||
"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() {
|
||||
|
10
remote.go
10
remote.go
@ -1,8 +1,14 @@
|
||||
package main
|
||||
package main
|
||||
|
||||
import (
|
||||
"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() {
|
||||
|
@ -1,8 +1,15 @@
|
||||
package main
|
||||
package main
|
||||
|
||||
import (
|
||||
"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() {
|
||||
|
@ -1,8 +1,15 @@
|
||||
package main
|
||||
package main
|
||||
|
||||
import (
|
||||
"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() {
|
||||
|
Reference in New Issue
Block a user