Skip to content

Instantly share code, notes, and snippets.

@theepicsnail
Created May 24, 2017
Embed
What would you like to do?
load("@io_bazel_rules_go//go:def.bzl", "go_prefix")
go_prefix("myThing") # No idea what this string should be. Probably matters *shrug*
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_prefix")
go_prefix("myThing") # again no idea. I don't really know go well enough.
go_binary(
name = "bin",
srcs = [
"main.go"
]
)
package main
import "fmt"
func main() {
fmt.Printf("Hello, world.\n")
}
Note filenames use '_' instead of '/' because github won't let me put "myThing/BUILD" or "myThing/main.go"
snail@snailbox:~/go_bazel$ find .
.
./myThing
./myThing/BUILD
./myThing/main.go
./WORKSPACE
./BUILD
snail@snailbox:~/go_bazel$ bazel run //myThing:bin
INFO: Found 1 target...
Target //myThing:bin up-to-date:
bazel-bin/myThing/bin.a
bazel-bin/myThing/bin
INFO: Elapsed time: 4.390s, Critical Path: 0.96s
INFO: Running command line: bazel-bin/myThing/bin
Hello, world.
git_repository(
name = "io_bazel_rules_go",
remote = "https://github.com/bazelbuild/rules_go.git",
tag = "0.4.4",
)
load("@io_bazel_rules_go//go:def.bzl", "go_repositories")
go_repositories()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment