Skip to content

Instantly share code, notes, and snippets.

@theepicsnail
Created May 24, 2017 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theepicsnail/2ee5da7711d74a043fe5e6436e7df245 to your computer and use it in GitHub Desktop.
Save theepicsnail/2ee5da7711d74a043fe5e6436e7df245 to your computer and use it in GitHub Desktop.
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