From d66cfe11452d213b5d10f48fbe5932259413b041 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Thu, 4 May 2023 14:00:30 -0700 Subject: [PATCH] Cut over to Bazel. --- .gitignore | 4 + BUILD.bazel | 12 ++ WORKSPACE | 39 ++++ ahash/BUILD.bazel | 23 ++ assert/BUILD.bazel | 8 + cmd/atping/BUILD.bazel | 14 ++ cmd/certchain/BUILD.bazel | 15 ++ cmd/certdump/BUILD.bazel | 22 ++ cmd/certexpiry/BUILD.bazel | 19 ++ cmd/certverify/BUILD.bazel | 20 ++ cmd/clustersh/BUILD.bazel | 20 ++ cmd/cruntar/BUILD.bazel | 15 ++ cmd/csrpubdump/BUILD.bazel | 15 ++ cmd/eig/BUILD.bazel | 15 ++ cmd/fragment/BUILD.bazel | 15 ++ cmd/jlp/BUILD.bazel | 15 ++ cmd/kgz/BUILD.bazel | 15 ++ cmd/parts/BUILD.bazel | 15 ++ cmd/pem2bin/BUILD.bazel | 14 ++ cmd/pembody/BUILD.bazel | 15 ++ cmd/pemit/BUILD.bazel | 19 ++ cmd/readchain/BUILD.bazel | 14 ++ cmd/renfnv/BUILD.bazel | 18 ++ cmd/rhash/BUILD.bazel | 19 ++ cmd/showimp/BUILD.bazel | 18 ++ cmd/ski/BUILD.bazel | 18 ++ cmd/sprox/BUILD.bazel | 15 ++ cmd/stealchain-server/BUILD.bazel | 15 ++ cmd/stealchain/BUILD.bazel | 15 ++ cmd/subjhash/BUILD.bazel | 18 ++ cmd/tlskeypair/BUILD.bazel | 15 ++ cmd/utc/BUILD.bazel | 14 ++ cmd/yamll/BUILD.bazel | 15 ++ config/BUILD.bazel | 22 ++ config/iniconf/BUILD.bazel | 15 ++ dbg/BUILD.bazel | 18 ++ deps.bzl | 345 ++++++++++++++++++++++++++++++ die/BUILD.bazel | 8 + fileutil/BUILD.bazel | 9 + gazelle.sh | 14 ++ lib/BUILD.bazel | 116 ++++++++++ logging/BUILD.bazel | 24 +++ logging/example/BUILD.bazel | 15 ++ mwc/BUILD.bazel | 18 ++ rand/BUILD.bazel | 14 ++ sbuf/BUILD.bazel | 15 ++ seekbuf/BUILD.bazel | 8 + tee/BUILD.bazel | 8 + testio/BUILD.bazel | 14 ++ testutil/BUILD.bazel | 8 + 50 files changed, 1214 insertions(+) create mode 100644 .gitignore create mode 100644 BUILD.bazel create mode 100644 WORKSPACE create mode 100644 ahash/BUILD.bazel create mode 100644 assert/BUILD.bazel create mode 100644 cmd/atping/BUILD.bazel create mode 100644 cmd/certchain/BUILD.bazel create mode 100644 cmd/certdump/BUILD.bazel create mode 100644 cmd/certexpiry/BUILD.bazel create mode 100644 cmd/certverify/BUILD.bazel create mode 100644 cmd/clustersh/BUILD.bazel create mode 100644 cmd/cruntar/BUILD.bazel create mode 100644 cmd/csrpubdump/BUILD.bazel create mode 100644 cmd/eig/BUILD.bazel create mode 100644 cmd/fragment/BUILD.bazel create mode 100644 cmd/jlp/BUILD.bazel create mode 100644 cmd/kgz/BUILD.bazel create mode 100644 cmd/parts/BUILD.bazel create mode 100644 cmd/pem2bin/BUILD.bazel create mode 100644 cmd/pembody/BUILD.bazel create mode 100644 cmd/pemit/BUILD.bazel create mode 100644 cmd/readchain/BUILD.bazel create mode 100644 cmd/renfnv/BUILD.bazel create mode 100644 cmd/rhash/BUILD.bazel create mode 100644 cmd/showimp/BUILD.bazel create mode 100644 cmd/ski/BUILD.bazel create mode 100644 cmd/sprox/BUILD.bazel create mode 100644 cmd/stealchain-server/BUILD.bazel create mode 100644 cmd/stealchain/BUILD.bazel create mode 100644 cmd/subjhash/BUILD.bazel create mode 100644 cmd/tlskeypair/BUILD.bazel create mode 100644 cmd/utc/BUILD.bazel create mode 100644 cmd/yamll/BUILD.bazel create mode 100644 config/BUILD.bazel create mode 100644 config/iniconf/BUILD.bazel create mode 100644 dbg/BUILD.bazel create mode 100644 deps.bzl create mode 100644 die/BUILD.bazel create mode 100644 fileutil/BUILD.bazel create mode 100755 gazelle.sh create mode 100644 lib/BUILD.bazel create mode 100644 logging/BUILD.bazel create mode 100644 logging/example/BUILD.bazel create mode 100644 mwc/BUILD.bazel create mode 100644 rand/BUILD.bazel create mode 100644 sbuf/BUILD.bazel create mode 100644 seekbuf/BUILD.bazel create mode 100644 tee/BUILD.bazel create mode 100644 testio/BUILD.bazel create mode 100644 testutil/BUILD.bazel diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2010e3c --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +bazel-bin +bazel-goutils +bazel-out +bazel-testlogs diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..c29d136 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,12 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@bazel_gazelle//:def.bzl", "gazelle") + +# gazelle:prefix git.wntrmute.dev/kyle/goutils +gazelle(name = "gazelle") + +go_library( + name = "goutils", + srcs = ["doc.go"], + importpath = "git.wntrmute.dev/kyle/goutils", + visibility = ["//visibility:public"], +) diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..c24be21 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,39 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "io_bazel_rules_go", + sha256 = "6b65cb7917b4d1709f9410ffe00ecf3e160edf674b78c54a894471320862184f", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.39.0.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.39.0/rules_go-v0.39.0.zip", + ], +) + +http_archive( + name = "bazel_gazelle", + sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz", + ], +) + +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") + +############################################################ +# Define your own dependencies here using go_repository. +# Else, dependencies declared by rules_go/gazelle will be used. +# The first declaration of an external repository "wins". +############################################################ + +load("//:deps.bzl", "go_dependencies") + +# gazelle:repository_macro deps.bzl%go_dependencies +go_dependencies() + +go_rules_dependencies() + +go_register_toolchains(version = "1.20.4") + +gazelle_dependencies() diff --git a/ahash/BUILD.bazel b/ahash/BUILD.bazel new file mode 100644 index 0000000..f57a52e --- /dev/null +++ b/ahash/BUILD.bazel @@ -0,0 +1,23 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "ahash", + srcs = ["ahash.go"], + importpath = "git.wntrmute.dev/kyle/goutils/ahash", + visibility = ["//visibility:public"], + deps = [ + "@ht_sr_git_kisom_goutils//assert:go_default_library", + "@org_golang_x_crypto//blake2b", + "@org_golang_x_crypto//blake2s", + "@org_golang_x_crypto//md4", + "@org_golang_x_crypto//ripemd160", + "@org_golang_x_crypto//sha3", + ], +) + +go_test( + name = "ahash_test", + srcs = ["ahash_test.go"], + embed = [":ahash"], + deps = ["@ht_sr_git_kisom_goutils//assert:go_default_library"], +) diff --git a/assert/BUILD.bazel b/assert/BUILD.bazel new file mode 100644 index 0000000..5e985ea --- /dev/null +++ b/assert/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "assert", + srcs = ["assert.go"], + importpath = "git.wntrmute.dev/kyle/goutils/assert", + visibility = ["//visibility:public"], +) diff --git a/cmd/atping/BUILD.bazel b/cmd/atping/BUILD.bazel new file mode 100644 index 0000000..f0b76be --- /dev/null +++ b/cmd/atping/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "atping_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/atping", + visibility = ["//visibility:private"], +) + +go_binary( + name = "atping", + embed = [":atping_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/certchain/BUILD.bazel b/cmd/certchain/BUILD.bazel new file mode 100644 index 0000000..8f52448 --- /dev/null +++ b/cmd/certchain/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "certchain_lib", + srcs = ["certchain.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/certchain", + visibility = ["//visibility:private"], + deps = ["@ht_sr_git_kisom_goutils//die:go_default_library"], +) + +go_binary( + name = "certchain", + embed = [":certchain_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/certdump/BUILD.bazel b/cmd/certdump/BUILD.bazel new file mode 100644 index 0000000..b67008e --- /dev/null +++ b/cmd/certdump/BUILD.bazel @@ -0,0 +1,22 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "certdump_lib", + srcs = [ + "certdump.go", + "util.go", + ], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/certdump", + visibility = ["//visibility:private"], + deps = [ + "@com_github_cloudflare_cfssl//errors", + "@com_github_cloudflare_cfssl//helpers", + "@com_github_kr_text//:text", + ], +) + +go_binary( + name = "certdump", + embed = [":certdump_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/certexpiry/BUILD.bazel b/cmd/certexpiry/BUILD.bazel new file mode 100644 index 0000000..1fbd180 --- /dev/null +++ b/cmd/certexpiry/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "certexpiry_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/certexpiry", + visibility = ["//visibility:private"], + deps = [ + "@com_github_cloudflare_cfssl//helpers", + "@ht_sr_git_kisom_goutils//die:go_default_library", + "@ht_sr_git_kisom_goutils//lib:go_default_library", + ], +) + +go_binary( + name = "certexpiry", + embed = [":certexpiry_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/certverify/BUILD.bazel b/cmd/certverify/BUILD.bazel new file mode 100644 index 0000000..ca403fd --- /dev/null +++ b/cmd/certverify/BUILD.bazel @@ -0,0 +1,20 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "certverify_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/certverify", + visibility = ["//visibility:private"], + deps = [ + "@com_github_cloudflare_cfssl//helpers", + "@com_github_cloudflare_cfssl//revoke", + "@ht_sr_git_kisom_goutils//die:go_default_library", + "@ht_sr_git_kisom_goutils//lib:go_default_library", + ], +) + +go_binary( + name = "certverify", + embed = [":certverify_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/clustersh/BUILD.bazel b/cmd/clustersh/BUILD.bazel new file mode 100644 index 0000000..8490736 --- /dev/null +++ b/cmd/clustersh/BUILD.bazel @@ -0,0 +1,20 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "clustersh_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/clustersh", + visibility = ["//visibility:private"], + deps = [ + "@com_github_pkg_sftp//:sftp", + "@ht_sr_git_kisom_goutils//lib:go_default_library", + "@org_golang_x_crypto//ssh", + "@org_golang_x_crypto//ssh/agent", + ], +) + +go_binary( + name = "clustersh", + embed = [":clustersh_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/cruntar/BUILD.bazel b/cmd/cruntar/BUILD.bazel new file mode 100644 index 0000000..c2c0fa9 --- /dev/null +++ b/cmd/cruntar/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "cruntar_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/cruntar", + visibility = ["//visibility:private"], + deps = ["@ht_sr_git_kisom_goutils//die:go_default_library"], +) + +go_binary( + name = "cruntar", + embed = [":cruntar_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/csrpubdump/BUILD.bazel b/cmd/csrpubdump/BUILD.bazel new file mode 100644 index 0000000..54df914 --- /dev/null +++ b/cmd/csrpubdump/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "csrpubdump_lib", + srcs = ["pubdump.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/csrpubdump", + visibility = ["//visibility:private"], + deps = ["@ht_sr_git_kisom_goutils//die:go_default_library"], +) + +go_binary( + name = "csrpubdump", + embed = [":csrpubdump_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/eig/BUILD.bazel b/cmd/eig/BUILD.bazel new file mode 100644 index 0000000..7bb114e --- /dev/null +++ b/cmd/eig/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "eig_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/eig", + visibility = ["//visibility:private"], + deps = ["@ht_sr_git_kisom_goutils//die:go_default_library"], +) + +go_binary( + name = "eig", + embed = [":eig_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/fragment/BUILD.bazel b/cmd/fragment/BUILD.bazel new file mode 100644 index 0000000..cbd00b5 --- /dev/null +++ b/cmd/fragment/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "fragment_lib", + srcs = ["fragment.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/fragment", + visibility = ["//visibility:private"], + deps = ["@ht_sr_git_kisom_goutils//die:go_default_library"], +) + +go_binary( + name = "fragment", + embed = [":fragment_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/jlp/BUILD.bazel b/cmd/jlp/BUILD.bazel new file mode 100644 index 0000000..9a1cb59 --- /dev/null +++ b/cmd/jlp/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "jlp_lib", + srcs = ["jlp.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/jlp", + visibility = ["//visibility:private"], + deps = ["@ht_sr_git_kisom_goutils//lib:go_default_library"], +) + +go_binary( + name = "jlp", + embed = [":jlp_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/kgz/BUILD.bazel b/cmd/kgz/BUILD.bazel new file mode 100644 index 0000000..4d2a306 --- /dev/null +++ b/cmd/kgz/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "kgz_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/kgz", + visibility = ["//visibility:private"], + deps = ["@com_github_pkg_errors//:errors"], +) + +go_binary( + name = "kgz", + embed = [":kgz_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/parts/BUILD.bazel b/cmd/parts/BUILD.bazel new file mode 100644 index 0000000..6fb66cf --- /dev/null +++ b/cmd/parts/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "parts_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/parts", + visibility = ["//visibility:private"], + deps = ["@ht_sr_git_kisom_goutils//die:go_default_library"], +) + +go_binary( + name = "parts", + embed = [":parts_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/pem2bin/BUILD.bazel b/cmd/pem2bin/BUILD.bazel new file mode 100644 index 0000000..484868a --- /dev/null +++ b/cmd/pem2bin/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "pem2bin_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/pem2bin", + visibility = ["//visibility:private"], +) + +go_binary( + name = "pem2bin", + embed = [":pem2bin_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/pembody/BUILD.bazel b/cmd/pembody/BUILD.bazel new file mode 100644 index 0000000..05c2b07 --- /dev/null +++ b/cmd/pembody/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "pembody_lib", + srcs = ["pembody.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/pembody", + visibility = ["//visibility:private"], + deps = ["@ht_sr_git_kisom_goutils//lib:go_default_library"], +) + +go_binary( + name = "pembody", + embed = [":pembody_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/pemit/BUILD.bazel b/cmd/pemit/BUILD.bazel new file mode 100644 index 0000000..37ca13e --- /dev/null +++ b/cmd/pemit/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "pemit_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/pemit", + visibility = ["//visibility:private"], + deps = [ + "@ht_sr_git_kisom_goutils//assert:go_default_library", + "@ht_sr_git_kisom_goutils//die:go_default_library", + "@ht_sr_git_kisom_goutils//lib:go_default_library", + ], +) + +go_binary( + name = "pemit", + embed = [":pemit_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/readchain/BUILD.bazel b/cmd/readchain/BUILD.bazel new file mode 100644 index 0000000..9153f0e --- /dev/null +++ b/cmd/readchain/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "readchain_lib", + srcs = ["chain.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/readchain", + visibility = ["//visibility:private"], +) + +go_binary( + name = "readchain", + embed = [":readchain_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/renfnv/BUILD.bazel b/cmd/renfnv/BUILD.bazel new file mode 100644 index 0000000..884fd1a --- /dev/null +++ b/cmd/renfnv/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "renfnv_lib", + srcs = ["renfnv.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/renfnv", + visibility = ["//visibility:private"], + deps = [ + "@ht_sr_git_kisom_goutils//fileutil:go_default_library", + "@ht_sr_git_kisom_goutils//lib:go_default_library", + ], +) + +go_binary( + name = "renfnv", + embed = [":renfnv_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/rhash/BUILD.bazel b/cmd/rhash/BUILD.bazel new file mode 100644 index 0000000..286d3aa --- /dev/null +++ b/cmd/rhash/BUILD.bazel @@ -0,0 +1,19 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "rhash_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/rhash", + visibility = ["//visibility:private"], + deps = [ + "@ht_sr_git_kisom_goutils//ahash:go_default_library", + "@ht_sr_git_kisom_goutils//die:go_default_library", + "@ht_sr_git_kisom_goutils//lib:go_default_library", + ], +) + +go_binary( + name = "rhash", + embed = [":rhash_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/showimp/BUILD.bazel b/cmd/showimp/BUILD.bazel new file mode 100644 index 0000000..efbd204 --- /dev/null +++ b/cmd/showimp/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "showimp_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/showimp", + visibility = ["//visibility:private"], + deps = [ + "@ht_sr_git_kisom_goutils//die:go_default_library", + "@ht_sr_git_kisom_goutils//logging:go_default_library", + ], +) + +go_binary( + name = "showimp", + embed = [":showimp_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/ski/BUILD.bazel b/cmd/ski/BUILD.bazel new file mode 100644 index 0000000..b65e476 --- /dev/null +++ b/cmd/ski/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "ski_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/ski", + visibility = ["//visibility:private"], + deps = [ + "@ht_sr_git_kisom_goutils//die:go_default_library", + "@ht_sr_git_kisom_goutils//lib:go_default_library", + ], +) + +go_binary( + name = "ski", + embed = [":ski_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/sprox/BUILD.bazel b/cmd/sprox/BUILD.bazel new file mode 100644 index 0000000..92bd382 --- /dev/null +++ b/cmd/sprox/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "sprox_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/sprox", + visibility = ["//visibility:private"], + deps = ["@ht_sr_git_kisom_goutils//die:go_default_library"], +) + +go_binary( + name = "sprox", + embed = [":sprox_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/stealchain-server/BUILD.bazel b/cmd/stealchain-server/BUILD.bazel new file mode 100644 index 0000000..009dea5 --- /dev/null +++ b/cmd/stealchain-server/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "stealchain-server_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/stealchain-server", + visibility = ["//visibility:private"], + deps = ["@ht_sr_git_kisom_goutils//die:go_default_library"], +) + +go_binary( + name = "stealchain-server", + embed = [":stealchain-server_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/stealchain/BUILD.bazel b/cmd/stealchain/BUILD.bazel new file mode 100644 index 0000000..b5b6c95 --- /dev/null +++ b/cmd/stealchain/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "stealchain_lib", + srcs = ["thief.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/stealchain", + visibility = ["//visibility:private"], + deps = ["@ht_sr_git_kisom_goutils//die:go_default_library"], +) + +go_binary( + name = "stealchain", + embed = [":stealchain_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/subjhash/BUILD.bazel b/cmd/subjhash/BUILD.bazel new file mode 100644 index 0000000..7b62d2a --- /dev/null +++ b/cmd/subjhash/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "subjhash_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/subjhash", + visibility = ["//visibility:private"], + deps = [ + "@ht_sr_git_kisom_goutils//die:go_default_library", + "@ht_sr_git_kisom_goutils//lib:go_default_library", + ], +) + +go_binary( + name = "subjhash", + embed = [":subjhash_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/tlskeypair/BUILD.bazel b/cmd/tlskeypair/BUILD.bazel new file mode 100644 index 0000000..74f9549 --- /dev/null +++ b/cmd/tlskeypair/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "tlskeypair_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/tlskeypair", + visibility = ["//visibility:private"], + deps = ["@ht_sr_git_kisom_goutils//die:go_default_library"], +) + +go_binary( + name = "tlskeypair", + embed = [":tlskeypair_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/utc/BUILD.bazel b/cmd/utc/BUILD.bazel new file mode 100644 index 0000000..8b30434 --- /dev/null +++ b/cmd/utc/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "utc_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/utc", + visibility = ["//visibility:private"], +) + +go_binary( + name = "utc", + embed = [":utc_lib"], + visibility = ["//visibility:public"], +) diff --git a/cmd/yamll/BUILD.bazel b/cmd/yamll/BUILD.bazel new file mode 100644 index 0000000..e3ba162 --- /dev/null +++ b/cmd/yamll/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "yamll_lib", + srcs = ["main.go"], + importpath = "git.wntrmute.dev/kyle/goutils/cmd/yamll", + visibility = ["//visibility:private"], + deps = ["@in_gopkg_yaml_v2//:yaml_v2"], +) + +go_binary( + name = "yamll", + embed = [":yamll_lib"], + visibility = ["//visibility:public"], +) diff --git a/config/BUILD.bazel b/config/BUILD.bazel new file mode 100644 index 0000000..ae44615 --- /dev/null +++ b/config/BUILD.bazel @@ -0,0 +1,22 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "config", + srcs = [ + "config.go", + "path_linux.go", + ], + importpath = "git.wntrmute.dev/kyle/goutils/config", + visibility = ["//visibility:public"], + deps = ["@ht_sr_git_kisom_goutils//config/iniconf:go_default_library"], +) + +go_test( + name = "config_test", + srcs = [ + "config_test.go", + "path_test.go", + ], + data = glob(["testdata/**"]), + embed = [":config"], +) diff --git a/config/iniconf/BUILD.bazel b/config/iniconf/BUILD.bazel new file mode 100644 index 0000000..d8fdf6b --- /dev/null +++ b/config/iniconf/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "iniconf", + srcs = ["iniconf.go"], + importpath = "git.wntrmute.dev/kyle/goutils/config/iniconf", + visibility = ["//visibility:public"], +) + +go_test( + name = "iniconf_test", + srcs = ["iniconf_test.go"], + data = glob(["testdata/**"]), + embed = [":iniconf"], +) diff --git a/dbg/BUILD.bazel b/dbg/BUILD.bazel new file mode 100644 index 0000000..9a1774d --- /dev/null +++ b/dbg/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "dbg", + srcs = ["dbg.go"], + importpath = "git.wntrmute.dev/kyle/goutils/dbg", + visibility = ["//visibility:public"], +) + +go_test( + name = "dbg_test", + srcs = ["dbg_test.go"], + embed = [":dbg"], + deps = [ + "@com_github_stretchr_testify//require", + "@ht_sr_git_kisom_goutils//testio:go_default_library", + ], +) diff --git a/deps.bzl b/deps.bzl new file mode 100644 index 0000000..79387fa --- /dev/null +++ b/deps.bzl @@ -0,0 +1,345 @@ +load("@bazel_gazelle//:deps.bzl", "go_repository") + +def go_dependencies(): + go_repository( + name = "com_github_akavel_rsrc", + importpath = "github.com/akavel/rsrc", + sum = "h1:zjWn7ukO9Kc5Q62DOJCcxGpXC18RawVtYAGdz2aLlfw=", + version = "v0.8.0", + ) + go_repository( + name = "com_github_certifi_gocertifi", + importpath = "github.com/certifi/gocertifi", + sum = "h1:6/yVvBsKeAw05IUj4AzvrxaCnDjN4nUqKjW9+w5wixg=", + version = "v0.0.0-20180118203423-deb3ae2ef261", + ) + go_repository( + name = "com_github_cloudflare_backoff", + importpath = "github.com/cloudflare/backoff", + sum = "h1:8d1CEOF1xldesKds5tRG3tExBsMOgWYownMHNCsev54=", + version = "v0.0.0-20161212185259-647f3cdfc87a", + ) + go_repository( + name = "com_github_cloudflare_cfssl", + importpath = "github.com/cloudflare/cfssl", + sum = "h1:vFJDAvQgFSRbCn9zg8KpSrrEZrBAQ4KO5oNK7SXEyb0=", + version = "v1.5.0", + ) + go_repository( + name = "com_github_cloudflare_go_metrics", + importpath = "github.com/cloudflare/go-metrics", + sum = "h1:/8sZyuGTAU2+fYv0Sz9lBcipqX0b7i4eUl8pSStk/4g=", + version = "v0.0.0-20151117154305-6a9aea36fb41", + ) + go_repository( + name = "com_github_cloudflare_redoctober", + importpath = "github.com/cloudflare/redoctober", + sum = "h1:p0Q1GvgWtVf46XpMMibupKiE7aQxPYUIb+/jLTTK2kM=", + version = "v0.0.0-20171127175943-746a508df14c", + ) + go_repository( + name = "com_github_creack_pty", + importpath = "github.com/creack/pty", + sum = "h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=", + version = "v1.1.9", + ) + go_repository( + name = "com_github_daaku_go_zipexe", + importpath = "github.com/daaku/go.zipexe", + sum = "h1:VSOgZtH418pH9L16hC/JrgSNJbbAL26pj7lmD1+CGdY=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_davecgh_go_spew", + importpath = "github.com/davecgh/go-spew", + sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=", + version = "v1.1.1", + ) + go_repository( + name = "com_github_geertjohan_go_incremental", + importpath = "github.com/GeertJohan/go.incremental", + sum = "h1:7AH+pY1XUgQE4Y1HcXYaMqAI0m9yrFqo/jt0CW30vsg=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_geertjohan_go_rice", + importpath = "github.com/GeertJohan/go.rice", + sum = "h1:KkI6O9uMaQU3VEKaj01ulavtF7o1fWT7+pk/4voiMLQ=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_getsentry_raven_go", + importpath = "github.com/getsentry/raven-go", + sum = "h1:ELaJ1cjF2nEJeIlHXahGme22yG7TK+3jB6IGCq0Cdrc=", + version = "v0.0.0-20180121060056-563b81fc02b7", + ) + go_repository( + name = "com_github_go_sql_driver_mysql", + importpath = "github.com/go-sql-driver/mysql", + sum = "h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk=", + version = "v1.4.0", + ) + go_repository( + name = "com_github_golang_protobuf", + importpath = "github.com/golang/protobuf", + sum = "h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=", + version = "v1.3.1", + ) + go_repository( + name = "com_github_google_certificate_transparency_go", + importpath = "github.com/google/certificate-transparency-go", + sum = "h1:Yf1aXowfZ2nuboBsg7iYGLmwsOARdV86pfH3g95wXmE=", + version = "v1.0.21", + ) + go_repository( + name = "com_github_jessevdk_go_flags", + importpath = "github.com/jessevdk/go-flags", + sum = "h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA=", + version = "v1.4.0", + ) + go_repository( + name = "com_github_jmhodges_clock", + importpath = "github.com/jmhodges/clock", + sum = "h1:dYTbLf4m0a5u0KLmPfB6mgxbcV7588bOCx79hxa5Sr4=", + version = "v0.0.0-20160418191101-880ee4c33548", + ) + go_repository( + name = "com_github_jmoiron_sqlx", + importpath = "github.com/jmoiron/sqlx", + sum = "h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA=", + version = "v1.2.0", + ) + go_repository( + name = "com_github_kisielk_sqlstruct", + importpath = "github.com/kisielk/sqlstruct", + sum = "h1:o/c0aWEP/m6n61xlYW2QP4t9424qlJOsxugn5Zds2Rg=", + version = "v0.0.0-20150923205031-648daed35d49", + ) + go_repository( + name = "com_github_kisom_goutils", + importpath = "github.com/kisom/goutils", + sum = "h1:z4HEOgAnFq+e1+O4QdVsyDPatJDu5Ei/7w7DRbYjsIA=", + version = "v1.1.0", + ) + go_repository( + name = "com_github_konsorten_go_windows_terminal_sequences", + importpath = "github.com/konsorten/go-windows-terminal-sequences", + sum = "h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=", + version = "v1.0.1", + ) + go_repository( + name = "com_github_kr_fs", + importpath = "github.com/kr/fs", + sum = "h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=", + version = "v0.1.0", + ) + go_repository( + name = "com_github_kr_pretty", + importpath = "github.com/kr/pretty", + sum = "h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=", + version = "v0.1.0", + ) + go_repository( + name = "com_github_kr_pty", + importpath = "github.com/kr/pty", + sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=", + version = "v1.1.1", + ) + go_repository( + name = "com_github_kr_text", + importpath = "github.com/kr/text", + sum = "h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=", + version = "v0.2.0", + ) + go_repository( + name = "com_github_kylelemons_go_gypsy", + importpath = "github.com/kylelemons/go-gypsy", + sum = "h1:mkl3tvPHIuPaWsLtmHTybJeoVEW7cbePK73Ir8VtruA=", + version = "v0.0.0-20160905020020-08cad365cd28", + ) + go_repository( + name = "com_github_lib_pq", + importpath = "github.com/lib/pq", + sum = "h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU=", + version = "v1.3.0", + ) + go_repository( + name = "com_github_mattn_go_sqlite3", + importpath = "github.com/mattn/go-sqlite3", + sum = "h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=", + version = "v1.10.0", + ) + go_repository( + name = "com_github_mreiferson_go_httpclient", + importpath = "github.com/mreiferson/go-httpclient", + sum = "h1:oKIteTqeSpenyTrOVj5zkiyCaflLa8B+CD0324otT+o=", + version = "v0.0.0-20160630210159-31f0106b4474", + ) + go_repository( + name = "com_github_nkovacs_streamquote", + importpath = "github.com/nkovacs/streamquote", + sum = "h1:E2B8qYyeSgv5MXpmzZXRNp8IAQ4vjxIjhpAf5hv/tAg=", + version = "v0.0.0-20170412213628-49af9bddb229", + ) + go_repository( + name = "com_github_op_go_logging", + importpath = "github.com/op/go-logging", + sum = "h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88=", + version = "v0.0.0-20160315200505-970db520ece7", + ) + go_repository( + name = "com_github_pkg_errors", + importpath = "github.com/pkg/errors", + sum = "h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=", + version = "v0.9.1", + ) + go_repository( + name = "com_github_pkg_sftp", + importpath = "github.com/pkg/sftp", + sum = "h1:/f3b24xrDhkhddlaobPe2JgBqfdt+gC/NYl0QY9IOuI=", + version = "v1.12.0", + ) + go_repository( + name = "com_github_pmezard_go_difflib", + importpath = "github.com/pmezard/go-difflib", + sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_sirupsen_logrus", + importpath = "github.com/sirupsen/logrus", + sum = "h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME=", + version = "v1.3.0", + ) + go_repository( + name = "com_github_stretchr_objx", + importpath = "github.com/stretchr/objx", + sum = "h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=", + version = "v0.1.1", + ) + go_repository( + name = "com_github_stretchr_testify", + importpath = "github.com/stretchr/testify", + sum = "h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=", + version = "v1.6.1", + ) + go_repository( + name = "com_github_valyala_bytebufferpool", + importpath = "github.com/valyala/bytebufferpool", + sum = "h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_valyala_fasttemplate", + importpath = "github.com/valyala/fasttemplate", + sum = "h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8=", + version = "v1.0.1", + ) + go_repository( + name = "com_github_weppos_publicsuffix_go", + importpath = "github.com/weppos/publicsuffix-go", + sum = "h1:0Tu1uzLBd1jPn4k6OnMmOPZH/l/9bj9kUOMMkoRs6Gg=", + version = "v0.13.0", + ) + go_repository( + name = "com_github_ziutek_mymysql", + importpath = "github.com/ziutek/mymysql", + sum = "h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=", + version = "v1.5.4", + ) + go_repository( + name = "com_github_zmap_rc2", + importpath = "github.com/zmap/rc2", + sum = "h1:kKCF7VX/wTmdg2ZjEaqlq99Bjsoiz7vH6sFniF/vI4M=", + version = "v0.0.0-20131011165748-24b9757f5521", + ) + go_repository( + name = "com_github_zmap_zcertificate", + importpath = "github.com/zmap/zcertificate", + sum = "h1:17HHAgFKlLcZsDOjBOUrd5hDihb1ggf+1a5dTbkgkIY=", + version = "v0.0.0-20180516150559-0e3d58b1bac4", + ) + go_repository( + name = "com_github_zmap_zcrypto", + importpath = "github.com/zmap/zcrypto", + sum = "h1:PIpcdSOg3pMdFJUBg5yR9xxcj5rm/SGAyaWT/wK6Kco=", + version = "v0.0.0-20200911161511-43ff0ea04f21", + ) + go_repository( + name = "com_github_zmap_zlint_v2", + importpath = "github.com/zmap/zlint/v2", + sum = "h1:b2kI/ToXX16h2wjV2c6Da65eT6aTMtkLHKetXuM9EtI=", + version = "v2.2.1", + ) + go_repository( + name = "in_gopkg_check_v1", + importpath = "gopkg.in/check.v1", + sum = "h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=", + version = "v1.0.0-20180628173108-788fd7840127", + ) + go_repository( + name = "in_gopkg_yaml_v2", + importpath = "gopkg.in/yaml.v2", + sum = "h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=", + version = "v2.4.0", + ) + go_repository( + name = "in_gopkg_yaml_v3", + importpath = "gopkg.in/yaml.v3", + sum = "h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=", + version = "v3.0.0-20200313102051-9f266ea9e77c", + ) + go_repository( + name = "org_bitbucket_liamstask_goose", + importpath = "bitbucket.org/liamstask/goose", + sum = "h1:bkb2NMGo3/Du52wvYj9Whth5KZfMV6d3O0Vbr3nz/UE=", + version = "v0.0.0-20150115234039-8488cc47d90c", + ) + go_repository( + name = "org_golang_google_appengine", + importpath = "google.golang.org/appengine", + sum = "h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=", + version = "v1.6.6", + ) + go_repository( + name = "org_golang_x_crypto", + importpath = "golang.org/x/crypto", + sum = "h1:xYJJ3S178yv++9zXV/hnr29plCAGO9vAFG9dorqaFQc=", + version = "v0.0.0-20201124201722-c8d3bf9c5392", + ) + go_repository( + name = "org_golang_x_lint", + importpath = "golang.org/x/lint", + sum = "h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=", + version = "v0.0.0-20190930215403-16217165b5de", + ) + go_repository( + name = "org_golang_x_net", + importpath = "golang.org/x/net", + sum = "h1:mUVeFHoDKis5nxCAzoAi7E8Ghb86EXh/RK6wtvJIqRY=", + version = "v0.0.0-20201010224723-4f7140c49acb", + ) + go_repository( + name = "org_golang_x_sys", + importpath = "golang.org/x/sys", + sum = "h1:f1CIuDlJhwANEC2MM87MBEVMr3jl5bifgsfj90XAF9c=", + version = "v0.0.0-20201126233918-771906719818", + ) + go_repository( + name = "org_golang_x_term", + importpath = "golang.org/x/term", + sum = "h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM=", + version = "v0.0.0-20201117132131-f5c789dd3221", + ) + go_repository( + name = "org_golang_x_text", + importpath = "golang.org/x/text", + sum = "h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=", + version = "v0.3.3", + ) + go_repository( + name = "org_golang_x_tools", + importpath = "golang.org/x/tools", + sum = "h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ=", + version = "v0.0.0-20190311212946-11955173bddd", + ) diff --git a/die/BUILD.bazel b/die/BUILD.bazel new file mode 100644 index 0000000..88eaed1 --- /dev/null +++ b/die/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "die", + srcs = ["die.go"], + importpath = "git.wntrmute.dev/kyle/goutils/die", + visibility = ["//visibility:public"], +) diff --git a/fileutil/BUILD.bazel b/fileutil/BUILD.bazel new file mode 100644 index 0000000..c6bb885 --- /dev/null +++ b/fileutil/BUILD.bazel @@ -0,0 +1,9 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "fileutil", + srcs = ["fileutil.go"], + importpath = "git.wntrmute.dev/kyle/goutils/fileutil", + visibility = ["//visibility:public"], + deps = ["@org_golang_x_sys//unix"], +) diff --git a/gazelle.sh b/gazelle.sh new file mode 100755 index 0000000..5b14453 --- /dev/null +++ b/gazelle.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -euxo pipefail + +BAZEL="bazel" +if [ -z "$(command -v ${BAZEL})" ] +then + BAZEL="bazelisk" +fi + +$BAZEL run //:gazelle +$BAZEL run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%go_dependencies +$BAZEL run //:gazelle + diff --git a/lib/BUILD.bazel b/lib/BUILD.bazel new file mode 100644 index 0000000..da36b7f --- /dev/null +++ b/lib/BUILD.bazel @@ -0,0 +1,116 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "lib", + srcs = [ + "defs.go", + "ftime_bsd.go", + "ftime_unix.go", + "lib.go", + ], + importpath = "git.wntrmute.dev/kyle/goutils/lib", + visibility = ["//visibility:public"], + deps = select({ + "@io_bazel_rules_go//go/platform:android_386": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:android_amd64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:android_arm": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:android_arm64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:darwin_386": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:darwin_amd64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:freebsd_386": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:freebsd_amd64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:freebsd_arm": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:freebsd_arm64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:ios_amd64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:linux_386": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:linux_amd64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:linux_arm": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:linux_arm64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:linux_mips": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:linux_mips64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:linux_mips64le": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:linux_mipsle": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:linux_ppc64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:linux_ppc64le": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:linux_riscv64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:linux_s390x": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:netbsd_386": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:netbsd_amd64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:netbsd_arm": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:netbsd_arm64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:openbsd_386": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:openbsd_amd64": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:openbsd_arm": [ + "@org_golang_x_sys//unix", + ], + "@io_bazel_rules_go//go/platform:openbsd_arm64": [ + "@org_golang_x_sys//unix", + ], + "//conditions:default": [], + }), +) + +go_test( + name = "lib_test", + srcs = ["lib_test.go"], + embed = [":lib"], + deps = ["@ht_sr_git_kisom_goutils//assert:go_default_library"], +) diff --git a/logging/BUILD.bazel b/logging/BUILD.bazel new file mode 100644 index 0000000..0a400da --- /dev/null +++ b/logging/BUILD.bazel @@ -0,0 +1,24 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "logging", + srcs = [ + "console_logger.go", + "doc.go", + "file.go", + "levels.go", + "log.go", + ], + importpath = "git.wntrmute.dev/kyle/goutils/logging", + visibility = ["//visibility:public"], +) + +go_test( + name = "logging_test", + srcs = [ + "example_test.go", + "log_test.go", + ], + embed = [":logging"], + deps = ["@ht_sr_git_kisom_goutils//logging:go_default_library"], +) diff --git a/logging/example/BUILD.bazel b/logging/example/BUILD.bazel new file mode 100644 index 0000000..7b59a3c --- /dev/null +++ b/logging/example/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "example_lib", + srcs = ["example.go"], + importpath = "git.wntrmute.dev/kyle/goutils/logging/example", + visibility = ["//visibility:private"], + deps = ["@ht_sr_git_kisom_goutils//logging:go_default_library"], +) + +go_binary( + name = "example", + embed = [":example_lib"], + visibility = ["//visibility:public"], +) diff --git a/mwc/BUILD.bazel b/mwc/BUILD.bazel new file mode 100644 index 0000000..b58028a --- /dev/null +++ b/mwc/BUILD.bazel @@ -0,0 +1,18 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "mwc", + srcs = ["mwc.go"], + importpath = "git.wntrmute.dev/kyle/goutils/mwc", + visibility = ["//visibility:public"], +) + +go_test( + name = "mwc_test", + srcs = ["mwc_test.go"], + embed = [":mwc"], + deps = [ + "@ht_sr_git_kisom_goutils//assert:go_default_library", + "@ht_sr_git_kisom_goutils//testio:go_default_library", + ], +) diff --git a/rand/BUILD.bazel b/rand/BUILD.bazel new file mode 100644 index 0000000..443e133 --- /dev/null +++ b/rand/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "rand", + srcs = ["rand.go"], + importpath = "git.wntrmute.dev/kyle/goutils/rand", + visibility = ["//visibility:public"], +) + +go_test( + name = "rand_test", + srcs = ["rand_test.go"], + embed = [":rand"], +) diff --git a/sbuf/BUILD.bazel b/sbuf/BUILD.bazel new file mode 100644 index 0000000..ac72329 --- /dev/null +++ b/sbuf/BUILD.bazel @@ -0,0 +1,15 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "sbuf", + srcs = ["sbuf.go"], + importpath = "git.wntrmute.dev/kyle/goutils/sbuf", + visibility = ["//visibility:public"], +) + +go_test( + name = "sbuf_test", + srcs = ["sbuf_test.go"], + embed = [":sbuf"], + deps = ["@org_golang_x_crypto//nacl/box"], +) diff --git a/seekbuf/BUILD.bazel b/seekbuf/BUILD.bazel new file mode 100644 index 0000000..cd5d55f --- /dev/null +++ b/seekbuf/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "seekbuf", + srcs = ["seekbuf.go"], + importpath = "git.wntrmute.dev/kyle/goutils/seekbuf", + visibility = ["//visibility:public"], +) diff --git a/tee/BUILD.bazel b/tee/BUILD.bazel new file mode 100644 index 0000000..ed27272 --- /dev/null +++ b/tee/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "tee", + srcs = ["tee.go"], + importpath = "git.wntrmute.dev/kyle/goutils/tee", + visibility = ["//visibility:public"], +) diff --git a/testio/BUILD.bazel b/testio/BUILD.bazel new file mode 100644 index 0000000..96a12de --- /dev/null +++ b/testio/BUILD.bazel @@ -0,0 +1,14 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "testio", + srcs = ["testio.go"], + importpath = "git.wntrmute.dev/kyle/goutils/testio", + visibility = ["//visibility:public"], +) + +go_test( + name = "testio_test", + srcs = ["testio_test.go"], + embed = [":testio"], +) diff --git a/testutil/BUILD.bazel b/testutil/BUILD.bazel new file mode 100644 index 0000000..b76d1e7 --- /dev/null +++ b/testutil/BUILD.bazel @@ -0,0 +1,8 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "testutil", + srcs = ["testutil.go"], + importpath = "git.wntrmute.dev/kyle/goutils/testutil", + visibility = ["//visibility:public"], +)