Initial commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
bazel-*
|
13
BUILD
Normal file
13
BUILD
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
load("@bazel_tools//tools/build_rules/go:def.bzl", "go_prefix", "go_binary")
|
||||||
|
|
||||||
|
package(
|
||||||
|
default_visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
go_prefix("github.com/lar/bazel-example-golang")
|
||||||
|
|
||||||
|
go_binary(
|
||||||
|
name ="hello",
|
||||||
|
srcs = [ "hello.go" ],
|
||||||
|
deps = [ "//local" ],
|
||||||
|
)
|
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
An example project demonstrating bazel build rules for go with
|
||||||
|
a local binary (go_binary) and a local library (go_library).
|
||||||
|
|
||||||
|
This requires a release > `bazel-0.20`.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ bazel run :hello
|
||||||
|
```
|
3
WORKSPACE
Normal file
3
WORKSPACE
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
load("@bazel_tools//tools/build_rules/go:def.bzl", "go_repositories")
|
||||||
|
|
||||||
|
go_repositories()
|
11
hello.go
Normal file
11
hello.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/lar/bazel-example-golang/local/local"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Println("Hello", local.World())
|
||||||
|
}
|
7
local/BUILD
Normal file
7
local/BUILD
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
load("@bazel_tools//tools/build_rules/go:def.bzl", "go_library")
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name ="local",
|
||||||
|
srcs = [ "local.go" ],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
5
local/local.go
Normal file
5
local/local.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package local
|
||||||
|
|
||||||
|
func World() string {
|
||||||
|
return "local.World!"
|
||||||
|
}
|
Reference in New Issue
Block a user