Update WORKSPACE / BUILD to work with bazel at HEAD.

Uses external rules_go github repository.
This commit is contained in:
Laramie Leavitt
2016-03-21 16:56:03 -07:00
parent f189432d24
commit dad6f57d6d
11 changed files with 39 additions and 42 deletions

7
BUILD
View File

@ -1,4 +1,4 @@
load("@bazel_tools//tools/build_rules/go:def.bzl", "go_prefix", "go_binary") load("@io_bazel_rules_go//go:def.bzl", "go_prefix", "go_binary")
package( package(
default_visibility = ["//visibility:public"], default_visibility = ["//visibility:public"],
@ -9,11 +9,6 @@ go_prefix("github.com/laramiel/bazel-example-golang/")
go_binary( go_binary(
name = "hello", name = "hello",
srcs = ["hello.go"], srcs = ["hello.go"],
)
go_binary(
name = "local",
srcs = ["local.go"],
deps = [ deps = [
"//local", "//local",
], ],

View File

@ -8,6 +8,8 @@ This requires bazel release > `bazel-0.20`.
``` ```
$ git clone https://github.com/laramiel/bazel-example-golang.git $ git clone https://github.com/laramiel/bazel-example-golang.git
$ cd bazel-example-golang $ cd bazel-example-golang
$ git submodule init
$ git submodule foreach git pull origin master
$ bazel run :hello $ bazel run :hello

View File

@ -1,4 +1,10 @@
load("@bazel_tools//tools/build_rules/go:def.bzl", "go_repositories") git_repository(
name = "io_bazel_rules_go",
remote = "https://github.com/bazelbuild/rules_go.git",
commit = "373feb6",
)
load("@io_bazel_rules_go//go:def.bzl", "go_repositories")
go_repositories() go_repositories()

View File

@ -2,8 +2,12 @@ package main
import ( import (
"fmt" "fmt"
"github.com/laramiel/bazel-example-golang/local/local"
) )
func main() { func main() {
fmt.Println("Hello World") fmt.Println("Hello World")
fmt.Println("Hello ", local.World())
} }

View File

@ -1,10 +0,0 @@
package main
import (
"fmt"
"github.com/laramiel/bazel-example-golang/local/local"
)
func main() {
fmt.Println("Hello ", local.World())
}

View File

@ -1,4 +1,4 @@
load("@bazel_tools//tools/build_rules/go:def.bzl", "go_library") load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library( go_library(
name ="local", name ="local",

View File

@ -1,20 +1,20 @@
load("@bazel_tools//tools/build_rules/go:def.bzl", "go_prefix", "go_binary") load("@io_bazel_rules_go//go:def.bzl", "go_binary")
package( package(
default_visibility = ["//visibility:public"], default_visibility = ["//visibility:public"],
) )
go_binary( go_binary(
name ="bare", name = "bare",
srcs = [ "bare.go" ], srcs = ["bare.go"],
deps = [ deps = [
"//submodule/src:bare", "//submodule/src:bare",
], ],
) )
go_binary( go_binary(
name ="remote", name = "remote",
srcs = [ "remote.go" ], srcs = ["remote.go"],
deps = [ deps = [
"//submodule/src/remote", "//submodule/src/remote",
], ],

4
vendor/github.com/laramiel/BUILD generated vendored
View File

@ -1,7 +1,7 @@
load("@bazel_tools//tools/build_rules/go:def.bzl", "go_library") load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library( go_library(
name = "bare", name = "bare",
srcs = [ "bazel-example-golang-bare/bare.go" ], srcs = ["bazel-example-golang-bare/bare.go"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )

View File

@ -1,4 +1,4 @@
load("@bazel_tools//tools/build_rules/go:def.bzl", "go_prefix", "go_binary") load("@io_bazel_rules_go//go:def.bzl", "go_binary")
package( package(
default_visibility = ["//visibility:public"], default_visibility = ["//visibility:public"],
@ -16,8 +16,8 @@ package(
#) #)
go_binary( go_binary(
name ="remote", name = "remote",
srcs = [ "remote.go" ], srcs = ["remote.go"],
deps = [ deps = [
"//vendor/github.com/laramiel/bazel-example-golang-remote:remote", "//vendor/github.com/laramiel/bazel-example-golang-remote:remote",
], ],