Skip to content

Instantly share code, notes, and snippets.

View jmhodges's full-sized avatar
🐶
return of the

Jeff Hodges jmhodges

🐶
return of the
View GitHub Profile
@jmhodges
jmhodges / doc.go
Last active August 14, 2023 13:24
Generating protobuf Go files with `go generate` and a vendored protobuf package (specifically, vendored with godep).
//go:generate protoc --go_out=import_prefix=github.com/your_github_acct/your_repo/Godeps/_workspace/src/:. your_proto_file.proto
package yourprotopkg
@jmhodges
jmhodges / pre-#2226 flags.Args
Last active September 27, 2019 07:46
rules_go #2233
[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
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
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)
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
jmhodges / grab_all_images.sh
Created April 16, 2017 02:04
Grab pod name, container name, and container image from kubernetes with kubectl
#!/bin/bash
kubectl get po --template '{{ range $i, $p := .items }}{{ range $j, $c := $p.spec.containers }}{{ printf "%s %s %s\n" $p.metadata.name $c.name $c.image }}{{ end }}{{ end }}'
@jmhodges
jmhodges / go-sqlite3.bzl
Created October 22, 2016 08:08
a new_git_repository for go-sqlite3 at 7204887cf3a42df1cfaa5505dc3a3427f6dded8b
# 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.
new_git_repository(
name = "com_github_mattn_go_sqlite3",
remote = "https://github.com/mattn/go-sqlite3.git",
commit = "7204887cf3a42df1cfaa5505dc3a3427f6dded8b",
build_file_content = """
load("@io_bazel_rules_go//go:def.bzl", "cgo_library", "go_library", "go_test", "go_prefix")
go_prefix("github.com/mattn/go-sqlite3")
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmhodges
jmhodges / gist:8273329
Created January 5, 2014 20:21
Amazon's TLS is sad. When given far better options by the client, it still uses TLS 1.0 and ancient ciphers.
$ # This DYLD_LIBRARY_PATH is because the default OS X 10.8 (and, I think, 10.9) still doesn't have
$ # a modern OpenSSL installation. You'll want `openssl version` to be 1.0.1e, at least.
$ DYLD_LIBRARY_PATH=/usr/local/ssl/lib:$DYLD_LIBRARY_PATH /usr/local/ssl/bin/openssl s_client -connect console.aws.amazon.com:443 < /dev/null 2>/dev/null | egrep '(Protocol|Cipher)\s+:'
Protocol : TLSv1
Cipher : RC4-MD5
$ # :( :( The same result for aws.amazon.com. Amazon.com still uses TLS 1.0 and RC4-SHA, too!
923168 53.7032% cloudflaressl.com *****************************************************
113932 6.6277% cloudflare.com ******
30204 1.7570% tum.de *
25858 1.5042% mpg.de *
13705 0.7973% asu.edu
13634 0.7931% gwstest.net
11823 0.6878% hu-berlin.de
11006 0.6402% badssl.com
10323 0.6005% cornell.edu
9521 0.5539% tu-berlin.de