Make examples more consistent.
Move submodule examples into submodule/*
This commit is contained in:
23
BUILD
23
BUILD
@ -4,11 +4,16 @@ package(
|
||||
default_visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
go_prefix("github.com/laramiel/bazel-example-golang")
|
||||
go_prefix("github.com/laramiel/bazel-example-golang/")
|
||||
|
||||
go_binary(
|
||||
name ="hello",
|
||||
srcs = [ "hello.go" ],
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name ="local",
|
||||
srcs = [ "local.go" ],
|
||||
deps = [
|
||||
"//local",
|
||||
],
|
||||
@ -29,19 +34,3 @@ go_binary(
|
||||
"@bare//:bare",
|
||||
],
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name ="subbare",
|
||||
srcs = [ "subbare.go" ],
|
||||
deps = [
|
||||
"//submodule/src:bare",
|
||||
],
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name ="subremote",
|
||||
srcs = [ "subremote.go" ],
|
||||
deps = [
|
||||
"//submodule/src/remote",
|
||||
],
|
||||
)
|
||||
|
@ -7,4 +7,10 @@ This requires bazel release > `bazel-0.20`.
|
||||
|
||||
```
|
||||
$ bazel run :hello
|
||||
|
||||
$ bazel run :remote
|
||||
$ bazel run :bare
|
||||
$ bazel run :subbare
|
||||
$ bazel run :subremote
|
||||
```
|
||||
|
||||
|
3
hello.go
3
hello.go
@ -2,9 +2,8 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/laramiel/bazel-example-golang/local/local"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello", local.World())
|
||||
fmt.Println("Hello World")
|
||||
}
|
||||
|
10
local.go
Normal file
10
local.go
Normal 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
21
submodule/BUILD
Normal 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",
|
||||
],
|
||||
)
|
@ -6,5 +6,5 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello", local.World())
|
||||
fmt.Println("Hello", bare.World())
|
||||
}
|
Reference in New Issue
Block a user