Make examples more consistent.

Move submodule examples into submodule/*
This commit is contained in:
Laramie Leavitt
2016-03-03 10:32:09 -08:00
parent d53f356dcd
commit 2c27d0f51d
7 changed files with 45 additions and 20 deletions

23
BUILD
View File

@ -4,11 +4,16 @@ package(
default_visibility = ["//visibility:public"], default_visibility = ["//visibility:public"],
) )
go_prefix("github.com/laramiel/bazel-example-golang") 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",
], ],
@ -29,19 +34,3 @@ go_binary(
"@bare//:bare", "@bare//:bare",
], ],
) )
go_binary(
name ="subbare",
srcs = [ "subbare.go" ],
deps = [
"//submodule/src:bare",
],
)
go_binary(
name ="subremote",
srcs = [ "subremote.go" ],
deps = [
"//submodule/src/remote",
],
)

View File

@ -7,4 +7,10 @@ This requires bazel release > `bazel-0.20`.
``` ```
$ bazel run :hello $ bazel run :hello
$ bazel run :remote
$ bazel run :bare
$ bazel run :subbare
$ bazel run :subremote
``` ```

View File

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

10
local.go Normal file
View File

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

21
submodule/BUILD Normal file
View File

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

View File

@ -6,5 +6,5 @@ import (
) )
func main() { func main() {
fmt.Println("Hello", local.World()) fmt.Println("Hello", bare.World())
} }