Add references to remote and bare repositories.
This commit is contained in:
22
BUILD
22
BUILD
@ -4,10 +4,28 @@ package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
go_prefix("github.com/lar/bazel-example-golang")
|
||||
go_prefix("github.com/laramiel/bazel-example-golang")
|
||||
|
||||
go_binary(
|
||||
name ="hello",
|
||||
srcs = [ "hello.go" ],
|
||||
deps = [ "//local" ],
|
||||
deps = [
|
||||
"//local",
|
||||
],
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name ="remote",
|
||||
srcs = [ "remote.go" ],
|
||||
deps = [
|
||||
"@remote//:remote",
|
||||
],
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name ="bare",
|
||||
srcs = [ "bare.go" ],
|
||||
deps = [
|
||||
"@bare//:bare",
|
||||
],
|
||||
)
|
27
WORKSPACE
27
WORKSPACE
@ -1,3 +1,30 @@
|
||||
load("@bazel_tools//tools/build_rules/go:def.bzl", "go_repositories")
|
||||
|
||||
go_repositories()
|
||||
|
||||
git_repository(
|
||||
name = "remote",
|
||||
remote = "https://github.com/laramiel/bazel-example-golang-remote.git",
|
||||
commit = "8f2e405",
|
||||
)
|
||||
|
||||
|
||||
BARE_BUILD = """
|
||||
load("@bazel_tools//tools/build_rules/go:def.bzl", "go_prefix", "go_library")
|
||||
|
||||
go_prefix("github.com/laramiel/bazel-example-golang-bare")
|
||||
|
||||
go_library(
|
||||
name = "bare",
|
||||
srcs = [ "bare.go" ],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
"""
|
||||
|
||||
new_git_repository(
|
||||
name = "bare",
|
||||
remote = "https://github.com/laramiel/bazel-example-golang-bare.git",
|
||||
commit = "3bd848f",
|
||||
build_file_content = BARE_BUILD
|
||||
)
|
||||
|
10
bare.go
Normal file
10
bare.go
Normal file
@ -0,0 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/laramiel/bazel-example-golang-bare/bare"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello", bare.World())
|
||||
}
|
3
hello.go
3
hello.go
@ -2,8 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/lar/bazel-example-golang/local/local"
|
||||
"github.com/laramiel/bazel-example-golang/local/local"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
Reference in New Issue
Block a user