Update WORKSPACE / BUILD to work with bazel at HEAD.
Uses external rules_go github repository.
This commit is contained in:
7
BUILD
7
BUILD
@ -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",
|
||||||
],
|
],
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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()
|
||||||
|
|
||||||
|
6
hello.go
6
hello.go
@ -1,9 +1,13 @@
|
|||||||
package main
|
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())
|
||||||
}
|
}
|
||||||
|
10
local.go
10
local.go
@ -1,10 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"github.com/laramiel/bazel-example-golang/local/local"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println("Hello ", local.World())
|
|
||||||
}
|
|
@ -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 ="local",
|
name ="local",
|
||||||
srcs = [ "local.go" ],
|
srcs = [ "local.go" ],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
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",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
Submodule submodule/src/remote updated: 8f2e405bb9...4a9199be6e
4
vendor/github.com/laramiel/BUILD
generated
vendored
4
vendor/github.com/laramiel/BUILD
generated
vendored
@ -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"],
|
||||||
)
|
)
|
||||||
|
2
vendor/github.com/laramiel/bazel-example-golang-remote
generated
vendored
2
vendor/github.com/laramiel/bazel-example-golang-remote
generated
vendored
Submodule vendor/github.com/laramiel/bazel-example-golang-remote updated: 8f2e405bb9...4a9199be6e
@ -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,9 +16,9 @@ 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",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user