Initial commit

This commit is contained in:
Laramie Leavitt
2016-03-02 01:00:40 -08:00
commit 1f5135d9bd
7 changed files with 49 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
bazel-*

13
BUILD Normal file
View 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
View 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
View File

@ -0,0 +1,3 @@
load("@bazel_tools//tools/build_rules/go:def.bzl", "go_repositories")
go_repositories()

11
hello.go Normal file
View 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
View 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
View File

@ -0,0 +1,5 @@
package local
func World() string {
return "local.World!"
}