From 96b5352755992e01ef1fa323cebd12a9dfae7e1e Mon Sep 17 00:00:00 2001 From: Laramie Leavitt Date: Wed, 2 Mar 2016 01:35:30 -0800 Subject: [PATCH] Add references to remote and bare repositories. --- BUILD | 22 ++++++++++++++++++++-- WORKSPACE | 27 +++++++++++++++++++++++++++ bare.go | 10 ++++++++++ hello.go | 3 +-- remote.go | 10 ++++++++++ 5 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 bare.go create mode 100644 remote.go diff --git a/BUILD b/BUILD index aba9c8f..22b7ee8 100644 --- a/BUILD +++ b/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", + ], ) \ No newline at end of file diff --git a/WORKSPACE b/WORKSPACE index 87a849d..cfe7870 100644 --- a/WORKSPACE +++ b/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 +) diff --git a/bare.go b/bare.go new file mode 100644 index 0000000..5b39678 --- /dev/null +++ b/bare.go @@ -0,0 +1,10 @@ +package main + +import ( + "fmt" + "github.com/laramiel/bazel-example-golang-bare/bare" +) + +func main() { + fmt.Println("Hello", bare.World()) +} diff --git a/hello.go b/hello.go index 5f50fe4..1268df7 100644 --- a/hello.go +++ b/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() { diff --git a/remote.go b/remote.go new file mode 100644 index 0000000..20230e1 --- /dev/null +++ b/remote.go @@ -0,0 +1,10 @@ +package main + +import ( + "fmt" + "github.com/laramiel/bazel-example-golang-remote/remote" +) + +func main() { + fmt.Println("Hello", remote.World()) +}