Skip to content

Commit

Permalink
Update bazel and various rules and dependencies (#184)
Browse files Browse the repository at this point in the history
* Update bazel and various rules and dependencies

* Drop to v3.5.0 again

Apparently there are no official bazel docker images
for v3.5.0+

Ref: bazelbuild/continuous-integration#1060

* Gazelle

* Sum

* Run go mod tidy after gazelle repos update
  • Loading branch information
johanbrandhorst committed Jul 2, 2021
1 parent f87ba71 commit 1455269
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 109 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
build --workspace_status_command="echo STABLE_GIT_SHA $(git rev-parse HEAD)"
test --features race
test --@io_bazel_rules_go//go/config:race
12 changes: 10 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,21 @@ jobs:
- save_bazel_test_cache
gazelle:
docker:
- image: l.gcr.io/google/bazel:3.5.0
- image: golang:1.16
steps:
- checkout
- run:
environment:
BAZELISK_VERSION: "1.4.0"
name: Install Bazelisk as bazel
command: |
wget -O /usr/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VERSION}/bazelisk-linux-amd64 &&
chmod +x /usr/bin/bazel
- configure_bazel
- restore_bazel_build_cache
- run: bazel run :gazelle
- run: bazel run :gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories
- run: bazel run :gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories -prune
- run: go mod tidy
- run: git diff --exit-code
buildifier:
docker:
Expand Down
31 changes: 15 additions & 16 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,29 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "d1ffd055969c8f8d431e2d439813e42326961d0942bdf734d2c95dc30c369566",
sha256 = "69de5c704a05ff37862f7e0f5534d4f479418afc21806c887db544a316f3cb6b",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.5/rules_go-v0.24.5.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.24.5/rules_go-v0.24.5.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.27.0/rules_go-v0.27.0.tar.gz",
],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains()

http_archive(
name = "bazel_gazelle",
sha256 = "b85f48fa105c4403326e9525ad2b2cc437babaa6e15a3fc0b1dbab0ab064bc7c",
sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")

go_rules_dependencies()

go_register_toolchains(version = "1.16")

gazelle_dependencies()

load("//:repositories.bzl", "go_repositories")
Expand Down Expand Up @@ -65,11 +64,11 @@ _go_image_repos()

http_archive(
name = "rules_proto",
sha256 = "9fc210a34f0f9e7cc31598d109b5d069ef44911a82f507d5a88716db171615a8",
strip_prefix = "rules_proto-f7a30f6f80006b591fa7c437fe5a951eb10bcbcf",
sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208",
strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/f7a30f6f80006b591fa7c437fe5a951eb10bcbcf.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/f7a30f6f80006b591fa7c437fe5a951eb10bcbcf.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz",
],
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/go-client/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
# gazelle:map_kind go_binary go_image @io_bazel_rules_docker//go:image.bzl

go_library(
name = "go_default_library",
name = "go-client",
srcs = ["main.go"],
importpath = "github.com/johanbrandhorst/bazel-mono/cmd/go-client",
visibility = ["//visibility:private"],
Expand All @@ -17,8 +17,8 @@ go_library(
)

go_image(
name = "go-client",
embed = [":go_default_library"],
name = "go-client-image",
embed = [":go-client"],
pure = "on",
static = "on",
visibility = ["//visibility:public"],
Expand All @@ -27,7 +27,7 @@ go_image(
container_push(
name = "publish",
format = "Docker",
image = "go-client",
image = "go-client-image",
registry = "docker.pkg.github.com",
repository = "johanbrandhorst/bazel-mono/go-client",
tag = "{STABLE_GIT_SHA}",
Expand Down
8 changes: 4 additions & 4 deletions cmd/go-server/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
# gazelle:map_kind go_binary go_image @io_bazel_rules_docker//go:image.bzl

go_library(
name = "go_default_library",
name = "go-server",
srcs = ["main.go"],
importpath = "github.com/johanbrandhorst/bazel-mono/cmd/go-server",
visibility = ["//visibility:private"],
Expand All @@ -21,8 +21,8 @@ go_library(
)

go_image(
name = "go-server",
embed = [":go_default_library"],
name = "go-server-image",
embed = [":go-server"],
pure = "on",
static = "on",
visibility = ["//visibility:public"],
Expand All @@ -31,7 +31,7 @@ go_image(
container_push(
name = "publish",
format = "Docker",
image = "go-server",
image = "go-server-image",
registry = "docker.pkg.github.com",
repository = "johanbrandhorst/bazel-mono/go-server",
tag = "{STABLE_GIT_SHA}",
Expand Down
3 changes: 1 addition & 2 deletions cmd/go-server/users/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ go_library(
"@com_github_jackc_pgx_v4//stdlib",
"@com_github_masterminds_squirrel//:squirrel",
"@com_github_sirupsen_logrus//:logrus",
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
"@org_golang_google_grpc//codes",
"@org_golang_google_grpc//status",
"@org_golang_google_protobuf//types/known/durationpb",
Expand All @@ -33,8 +32,8 @@ go_library(
go_test(
name = "users_test",
srcs = ["users_test.go"],
embed = [":users"],
deps = [
":users",
"//proto/myorg/users/v1:users",
"@com_github_google_go_cmp//cmp",
"@com_github_ory_dockertest_v3//:dockertest",
Expand Down
4 changes: 2 additions & 2 deletions cmd/go-server/users/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
migrate "github.com/golang-migrate/migrate/v4"
"github.com/golang-migrate/migrate/v4/database/postgres"
bindata "github.com/golang-migrate/migrate/v4/source/go_bindata"
"github.com/golang/protobuf/ptypes/timestamp"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/johanbrandhorst/bazel-mono/cmd/go-server/users/migrations"
pbUsers "github.com/johanbrandhorst/bazel-mono/proto/myorg/users/v1"
Expand Down Expand Up @@ -42,7 +42,7 @@ func validateSchema(db *sql.DB) error {

func scanUser(row squirrel.RowScanner) (*pbUsers.User, error) {
var user pbUsers.User
user.CreateTime = new(timestamp.Timestamp)
user.CreateTime = new(timestamppb.Timestamp)
err := row.Scan(
&user.Id,
(*roleWrapper)(&user.Role),
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require (
github.com/Masterminds/squirrel v1.5.0
github.com/fullstorydev/grpcui v1.1.0
github.com/golang-migrate/migrate/v4 v4.14.1
github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.6
github.com/jackc/pgconn v1.8.1
github.com/jackc/pgtype v1.7.0
Expand All @@ -17,5 +16,5 @@ require (
github.com/soheilhy/cmux v0.1.5
github.com/stretchr/testify v1.6.1 // indirect
google.golang.org/grpc v1.37.1
google.golang.org/protobuf v1.27.0
google.golang.org/protobuf v1.27.1
)
8 changes: 3 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
Expand Down Expand Up @@ -1033,9 +1032,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.0 h1:KhgSLlr/moiqjv0qUsSnLvdUL7NH7PHW8aZGn7Jpjko=
google.golang.org/protobuf v1.27.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
80 changes: 9 additions & 71 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,6 @@ def go_repositories():
version = "v2.2.1+incompatible",
)

go_repository(
name = "com_github_cenkalti_backoff_v3",
importpath = "github.com/cenkalti/backoff/v3",
sum = "h1:ske+9nBpD9qZsTBoF41nW5L+AIuFBKMeze18XQ3eG1c=",
version = "v3.0.0",
)
go_repository(
name = "com_github_cenkalti_backoff_v4",
importpath = "github.com/cenkalti/backoff/v4",
Expand Down Expand Up @@ -342,6 +336,7 @@ def go_repositories():
sum = "h1:cqQfy1jclcSy/FwLjemeg3SR1yaINm74aQyupQ0Bl8M=",
version = "v0.0.0-20201120205902-5459f2c99403",
)

go_repository(
name = "com_github_cockroachdb_apd",
importpath = "github.com/cockroachdb/apd",
Expand Down Expand Up @@ -713,8 +708,8 @@ def go_repositories():
go_repository(
name = "com_github_golang_protobuf",
importpath = "github.com/golang/protobuf",
sum = "h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=",
version = "v1.5.2",
sum = "h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=",
version = "v1.5.0",
)
go_repository(
name = "com_github_golang_snappy",
Expand Down Expand Up @@ -1169,12 +1164,7 @@ def go_repositories():
sum = "h1:6f4kVsW01QftE38ufBYxKciO6gyioXSC0ABIRLcZrGs=",
version = "v1.7.0",
)
go_repository(
name = "com_github_jackc_pgx",
importpath = "github.com/jackc/pgx",
sum = "h1:2zP5OD7kiyR3xzRYMhOcXVvkDZsImVXfj+yIyTQf3/o=",
version = "v3.6.2+incompatible",
)

go_repository(
name = "com_github_jackc_pgx_v4",
importpath = "github.com/jackc/pgx/v4",
Expand Down Expand Up @@ -1244,12 +1234,7 @@ def go_repositories():
sum = "h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=",
version = "v0.9.1",
)
go_repository(
name = "com_github_jteeuwen_go_bindata",
importpath = "github.com/jteeuwen/go-bindata",
sum = "h1:91Uy4d9SYVr1kyTJ15wJsog+esAZZl7JmEfTkwmhJts=",
version = "v3.0.7+incompatible",
)

go_repository(
name = "com_github_jtolds_gls",
importpath = "github.com/jtolds/gls",
Expand Down Expand Up @@ -1375,13 +1360,6 @@ def go_repositories():
version = "v0.0.13",
)

go_repository(
name = "com_github_magefile_mage",
importpath = "github.com/magefile/mage",
sum = "h1:3HiXzCUY12kh9bIuyXShaVe529fJfyqoVM42o/uom2g=",
version = "v1.10.0",
)

go_repository(
name = "com_github_magiconair_properties",
importpath = "github.com/magiconair/properties",
Expand Down Expand Up @@ -1590,12 +1568,6 @@ def go_repositories():
version = "v1.0.1",
)

go_repository(
name = "com_github_neo4j_drivers_gobolt",
importpath = "github.com/neo4j-drivers/gobolt",
sum = "h1:80c7W+vtw39ES9Q85q9GZh4tJo+1MpQGpFTuo28CP+Y=",
version = "v1.7.4",
)
go_repository(
name = "com_github_neo4j_neo4j_go_driver",
importpath = "github.com/neo4j/neo4j-go-driver",
Expand Down Expand Up @@ -2096,12 +2068,6 @@ def go_repositories():
sum = "h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=",
version = "v0.0.0-20190109142713-0ad062ec5ee5",
)
go_repository(
name = "com_github_tmthrgd_go_bindata",
importpath = "github.com/tmthrgd/go-bindata",
sum = "h1:fTaLzbXi8Yk24ntb/yp/sEX65EqXYJG4oP3/qPtb6uU=",
version = "v0.0.0-20190904063317-a4b65675e0fb",
)

go_repository(
name = "com_github_ugorji_go",
Expand All @@ -2122,18 +2088,6 @@ def go_repositories():
version = "v1.22.1",
)

go_repository(
name = "com_github_uw_labs_podrick",
importpath = "github.com/uw-labs/podrick",
sum = "h1:UtUWKpKzFK83Hb9eCClFNPKjsvs9hzaho7lRTwFBJVs=",
version = "v0.4.1",
)
go_repository(
name = "com_github_varlink_go",
importpath = "github.com/varlink/go",
sum = "h1:KcTzc0lm6PuIl9sAz5GMSGQyDhbJOa9NC3u69PVIc7Y=",
version = "v0.0.0-20191018142704-4ecdbb8a36c2",
)
go_repository(
name = "com_github_vividcortex_gohistogram",
importpath = "github.com/VividCortex/gohistogram",
Expand Down Expand Up @@ -2269,18 +2223,7 @@ def go_repositories():
sum = "h1:EDRyaRAnMGSq/QBto486gWFxMLczAfIYUmusV7XLNBM=",
version = "v0.19.0",
)
go_repository(
name = "dev_logur_adapter_logrus",
importpath = "logur.dev/adapter/logrus",
sum = "h1:cxsiceNXQLTKBk0keASgKAvrw9zzKa/XPE0Bn8tHXFI=",
version = "v0.5.0",
)
go_repository(
name = "dev_logur_logur",
importpath = "logur.dev/logur",
sum = "h1:Ui4VSx6gcQPkBlO8+KvSpJVv0y3q0FfnByjsyyOw/Vw=",
version = "v0.16.1",
)

go_repository(
name = "in_gopkg_alecthomas_kingpin_v2",
importpath = "gopkg.in/alecthomas/kingpin.v2",
Expand Down Expand Up @@ -2427,6 +2370,7 @@ def go_repositories():
sum = "h1:4r2CANuYhKGmYWP02+5E94rLRcS/YeD+KlxSrOsMxk0=",
version = "v0.1.1",
)

go_repository(
name = "io_rsc_binaryregexp",
importpath = "rsc.io/binaryregexp",
Expand Down Expand Up @@ -2477,17 +2421,11 @@ def go_repositories():
version = "v1.37.1",
)

go_repository(
name = "org_golang_google_grpc_examples",
importpath = "google.golang.org/grpc/examples",
sum = "h1:oJwcuADYZXzWc+5R6wAvg6Qo86cbqAInuyKepxHGhIo=",
version = "v0.0.0-20200915000551-32e7099cccac",
)
go_repository(
name = "org_golang_google_protobuf",
importpath = "google.golang.org/protobuf",
sum = "h1:KhgSLlr/moiqjv0qUsSnLvdUL7NH7PHW8aZGn7Jpjko=",
version = "v1.27.0",
sum = "h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=",
version = "v1.27.1",
)
go_repository(
name = "org_golang_x_crypto",
Expand Down

0 comments on commit 1455269

Please sign in to comment.