Skip to content

Instantly share code, notes, and snippets.

return of the

Jeff Hodges jmhodges

return of the
View GitHub Profile
View pre-#2226 flags.Args
[external/io_bazel_rules_go/BUILD.bazel external/io_bazel_rules_go/WORKSPACE external/io_bazel_rules_go/extras/BUILD.bazel external/io_bazel_rules_go/extras/bindata.bzl external/io_bazel_rules_go/extras/embed_data.bzl external/io_bazel_rules_go/extras/embed_data_deps.bzl external/io_bazel_rules_go/go/BUILD.bazel external/io_bazel_rules_go/go/core.rst external/io_bazel_rules_go/go/crosstool.rst external/io_bazel_rules_go/go/def.bzl external/io_bazel_rules_go/go/deps.bzl external/io_bazel_rules_go/go/extras.rst external/io_bazel_rules_go/go/modes.rst external/io_bazel_rules_go/go/nogo.rst external/io_bazel_rules_go/go/nogo_logo.png external/io_bazel_rules_go/go/platform/BUILD.bazel external/io_bazel_rules_go/go/platform/apple.bzl external/io_bazel_rules_go/go/platform/list.bzl external/io_bazel_rules_go/go/private/BUILD.bazel external/io_bazel_rules_go/go/private/BUILD.nogo.bazel external/io_bazel_rules_go/go/private/BUILD.sdk.bazel external/io_bazel_rules_go/go/private/actions/archive.bzl external/io_bazel_rul
View broken_errcheck.bzl
load("@io_bazel_rules_go//go:def.bzl", "go_context", "go_path", "go_rule")
load("@io_bazel_rules_go//go/private:providers.bzl", "GoLibrary", "GoPath")
_ERRCHECK_TOOL = "@com_github_kisielk_errcheck//:errcheck"
def _errcheck_sh_impl(ctx):
go = go_context(ctx)
gopath = ctx.attr.gopath_dep[GoPath].gopath
print("GOPATH IS ", gopath)
View gomock.bzl
load("@io_bazel_rules_go//go:def.bzl", "go_path")
load("@io_bazel_rules_go//go/private:providers.bzl", "GoLibrary", "GoPath")
_MOCKGEN_TOOL = "@com_github_golang_mock//mockgen"
def _gomock_sh_impl(ctx):
go_toolchain = ctx.toolchains["@io_bazel_rules_go//go:toolchain"]
gopath = "$(pwd)/" + ctx.var["BINDIR"] + "/" + ctx.attr.gopath_dep[GoPath].gopath
View bazeloutputgroups.txt
I do have one question that I haven't answered yet which is: are OutputGroups applied to dependencies or do they only apply the target being run and its dependencies aren't changed? I think it's the latter which is going to make this a lil annoying because of all of the `transitive_$WHATEVER` variables kicking around.
Anyway, here's as far as a I got:
I thought I could use OutputGroups and DefaultInfo at the very top of the stack, such that _go_binary_impl, etc. would look something like:
def _go_binary_impl(ctx):
"""go_binary_impl emits actions for compiling and linking a go executable."""
jmhodges /
Created Apr 16, 2017
Grab pod name, container name, and container image from kubernetes with kubectl
kubectl get po --template '{{ range $i, $p := .items }}{{ range $j, $c := $p.spec.containers }}{{ printf "%s %s %s\n" $ $ $c.image }}{{ end }}{{ end }}'
jmhodges / go-sqlite3.bzl
Created Oct 22, 2016
a new_git_repository for go-sqlite3 at 7204887cf3a42df1cfaa5505dc3a3427f6dded8b
View go-sqlite3.bzl
# sqlite3 has CGO deps and the version of rules_go we are using at the time of
# this comment (but maybe this will be fixed in the future!) doesn't have a way
# to get a nice high-level new_go_repository working with cgo code. So, we hack it here.
name = "com_github_mattn_go_sqlite3",
remote = "",
commit = "7204887cf3a42df1cfaa5505dc3a3427f6dded8b",
build_file_content = """
load("@io_bazel_rules_go//go:def.bzl", "cgo_library", "go_library", "go_test", "go_prefix")
View reallyfatarrows.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View suffixes.txt
923168 53.7032% *****************************************************
113932 6.6277% ******
30204 1.7570% *
25858 1.5042% *
13705 0.7973%
13634 0.7931%
11823 0.6878%
11006 0.6402%
10323 0.6005%
9521 0.5539%
jmhodges / output
Created Nov 12, 2015
View output
# receiver should be made into a pointer
func (revocationCodes).Len() int
# receiver should be made into a pointer
func (revocationCodes).Less(i int, j int) bool
# receiver should be made into a pointer
func (revocationCodes).Swap(i int, j int)
# return value 'certChecker' at index 0 should be made into a pointer
jmhodges / doc.go
Last active Aug 31, 2022
Generating protobuf Go files with `go generate` and a vendored protobuf package (specifically, vendored with godep).
View doc.go
//go:generate protoc your_proto_file.proto
package yourprotopkg