Skip to content

Instantly share code, notes, and snippets.

@rsc

rsc/BUILD Secret

Last active August 24, 2017 20:08
Embed
What would you like to do?
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_prefix")
go_prefix("rsc")
go_library(
name = "go_default_library",
srcs = ["hello.go"],
)
go_binary(
name = "hello",
library = ":go_default_library",
)
load("@io_bazel_rules_go//go/private:toolchain.bzl", "go_sdk_repository", "go_repository_select")
load("@io_bazel_rules_go//go/private:repository_tools.bzl", "go_repository_tools")
load("@io_bazel_rules_go//go/private:go_repository.bzl", "go_repository")
def go_repositories(go_version = None):
go_sdk_repository(
name = "go1_8_3_linux_amd64",
url = "https://go-boringcrypto.storage.googleapis.com/go1.8.3b2.linux-amd64.tar.gz",
sha256 = "a453918b6ed0208748b2d6e0def31abf528d649d5cd8ecc5b21c4fd46eb38aa1",
strip_prefix = "go",
)
# Needed for gazelle and wtool
native.http_archive(
name = "com_github_bazelbuild_buildtools",
url = "https://codeload.github.com/bazelbuild/buildtools/zip/d5dcc29f2304aa28c29ecb8337d52bb9de908e0c",
strip_prefix = "buildtools-d5dcc29f2304aa28c29ecb8337d52bb9de908e0c",
type = "zip",
)
# Needed for fetch repo
go_repository(
name = "org_golang_x_tools",
importpath = "golang.org/x/tools",
urls = ["https://codeload.github.com/golang/tools/zip/3d92dd60033c312e3ae7cac319c792271cf67e37"],
strip_prefix = "tools-3d92dd60033c312e3ae7cac319c792271cf67e37",
type = "zip",
)
go_repository_select(name = "io_bazel_rules_go_toolchain", go_version = go_version)
go_repository_tools(name = "io_bazel_rules_go_repository_tools")
package main
import "runtime"
func main() {
println("hello from", runtime.Version())
}
git_repository(
name = "io_bazel_rules_go",
remote = "https://github.com/bazelbuild/rules_go.git",
tag = "0.5.3",
)
load(":go-boringcrypto.bzl", "go_repositories")
go_repositories(go_version = "1.8.3")
@rsc
Copy link
Author

rsc commented Aug 22, 2017

$ bazel run :hello
____Loading complete.  Analyzing...
____Found 1 target...
____Building...
____[0 / 1] BazelWorkspaceStatusAction stable-status.txt
Target //:hello up-to-date:
  bazel-bin/hello
____Elapsed time: 0.292s, Critical Path: 0.01s

____Running command line: bazel-bin/hello
hello from go1.9rc2.boringcrypto.r1
$ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment