go: re-do the entire thing
This is a mega-change, but attempting to split this up further is
probably not worth the effort.
Summary:
1. Bump up bazel, rules_go, and others.
2. Switch to new go target naming (bye bye go_default_library)
3. Move go deps to go.mod/go.sum, use make gazelle generate from that
4. Bump up Python deps a bit
And also whatever was required to actually get things to work - loads of
small useless changes.
Tested to work on NixOS and Ubuntu 20.04:
$ bazel build //...
$ bazel test //...
Change-Id: I8364bdaa1406b9ae4d0385a6b607f3e7989f98a9
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1583
Reviewed-by: q3k <q3k@hackerspace.pl>
diff --git a/bgpwtf/cccampix/pgpencryptor/BUILD.bazel b/bgpwtf/cccampix/pgpencryptor/BUILD.bazel
index 2596087..6e808dd 100644
--- a/bgpwtf/cccampix/pgpencryptor/BUILD.bazel
+++ b/bgpwtf/cccampix/pgpencryptor/BUILD.bazel
@@ -1,25 +1,25 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
- name = "go_default_library",
+ name = "pgpencryptor_lib",
srcs = ["main.go"],
importpath = "code.hackerspace.pl/hscloud/bgpwtf/cccampix/pgpencryptor",
visibility = ["//visibility:private"],
deps = [
- "//bgpwtf/cccampix/pgpencryptor/gpg:go_default_library",
- "//bgpwtf/cccampix/pgpencryptor/hkp:go_default_library",
- "//bgpwtf/cccampix/pgpencryptor/model:go_default_library",
- "//bgpwtf/cccampix/proto:go_default_library",
- "//go/mirko:go_default_library",
- "@com_github_golang_glog//:go_default_library",
- "@com_github_lib_pq//:go_default_library",
- "@org_golang_google_grpc//codes:go_default_library",
- "@org_golang_google_grpc//status:go_default_library",
+ "//bgpwtf/cccampix/pgpencryptor/gpg",
+ "//bgpwtf/cccampix/pgpencryptor/hkp",
+ "//bgpwtf/cccampix/pgpencryptor/model",
+ "//bgpwtf/cccampix/proto",
+ "//go/mirko",
+ "@com_github_golang_glog//:glog",
+ "@com_github_lib_pq//:pq",
+ "@org_golang_google_grpc//codes",
+ "@org_golang_google_grpc//status",
],
)
go_binary(
name = "pgpencryptor",
- embed = [":go_default_library"],
+ embed = [":pgpencryptor_lib"],
visibility = ["//visibility:public"],
)
diff --git a/bgpwtf/cccampix/pgpencryptor/gpg/BUILD.bazel b/bgpwtf/cccampix/pgpencryptor/gpg/BUILD.bazel
index dbca7db..f80b49a 100644
--- a/bgpwtf/cccampix/pgpencryptor/gpg/BUILD.bazel
+++ b/bgpwtf/cccampix/pgpencryptor/gpg/BUILD.bazel
@@ -1,7 +1,7 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
- name = "go_default_library",
+ name = "gpg",
srcs = ["gpg.go"],
importpath = "code.hackerspace.pl/hscloud/bgpwtf/cccampix/pgpencryptor/gpg",
visibility = ["//visibility:public"],
diff --git a/bgpwtf/cccampix/pgpencryptor/hkp/BUILD.bazel b/bgpwtf/cccampix/pgpencryptor/hkp/BUILD.bazel
index a2377da..78ccce6 100644
--- a/bgpwtf/cccampix/pgpencryptor/hkp/BUILD.bazel
+++ b/bgpwtf/cccampix/pgpencryptor/hkp/BUILD.bazel
@@ -1,7 +1,7 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
- name = "go_default_library",
+ name = "hkp",
srcs = ["hkp.go"],
importpath = "code.hackerspace.pl/hscloud/bgpwtf/cccampix/pgpencryptor/hkp",
visibility = ["//visibility:public"],
diff --git a/bgpwtf/cccampix/pgpencryptor/model/BUILD.bazel b/bgpwtf/cccampix/pgpencryptor/model/BUILD.bazel
index b8cd8f4..a274e6f 100644
--- a/bgpwtf/cccampix/pgpencryptor/model/BUILD.bazel
+++ b/bgpwtf/cccampix/pgpencryptor/model/BUILD.bazel
@@ -1,7 +1,7 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
- name = "go_default_library",
+ name = "model",
srcs = [
"model.go",
"pgp.go",
@@ -10,10 +10,10 @@
importpath = "code.hackerspace.pl/hscloud/bgpwtf/cccampix/pgpencryptor/model",
visibility = ["//visibility:public"],
deps = [
- "//bgpwtf/cccampix/pgpencryptor/model/migrations:go_default_library",
- "@com_github_golang_migrate_migrate_v4//:go_default_library",
- "@com_github_golang_migrate_migrate_v4//database/cockroachdb:go_default_library",
- "@com_github_jmoiron_sqlx//:go_default_library",
- "@com_github_lib_pq//:go_default_library",
+ "//bgpwtf/cccampix/pgpencryptor/model/migrations",
+ "@com_github_golang_migrate_migrate_v4//:migrate",
+ "@com_github_golang_migrate_migrate_v4//database/cockroachdb",
+ "@com_github_jmoiron_sqlx//:sqlx",
+ "@com_github_lib_pq//:pq",
],
)
diff --git a/bgpwtf/cccampix/pgpencryptor/model/migrations/BUILD.bazel b/bgpwtf/cccampix/pgpencryptor/model/migrations/BUILD.bazel
index e6c3bb0..31efba9 100644
--- a/bgpwtf/cccampix/pgpencryptor/model/migrations/BUILD.bazel
+++ b/bgpwtf/cccampix/pgpencryptor/model/migrations/BUILD.bazel
@@ -4,12 +4,12 @@
go_embed_data(
name = "migrations_data",
srcs = glob(["*.sql"]),
- package = "migrations",
flatten = True,
+ package = "migrations",
)
go_library(
- name = "go_default_library",
+ name = "migrations",
srcs = [
"migrations.go",
":migrations_data", # keep
@@ -17,7 +17,7 @@
importpath = "code.hackerspace.pl/hscloud/bgpwtf/cccampix/pgpencryptor/model/migrations",
visibility = ["//bgpwtf/cccampix/pgpencryptor/model:__subpackages__"],
deps = [
- "//go/mirko:go_default_library",
- "@com_github_golang_migrate_migrate_v4//:go_default_library",
+ "//go/mirko",
+ "@com_github_golang_migrate_migrate_v4//:migrate",
],
)