Skip to content

Commit

Permalink
Remove depreated gogo
Browse files Browse the repository at this point in the history
  • Loading branch information
mering committed Nov 28, 2023
1 parent 91e3530 commit 3a574d2
Show file tree
Hide file tree
Showing 24 changed files with 2 additions and 7,251 deletions.
19 changes: 0 additions & 19 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ tasks:
- "-@com_google_protobuf//:timestamp_proto"
- "-@com_google_protobuf//:type_proto"
- "-@com_google_protobuf//:wrappers_proto"
- "-@gogo_special_proto//github.com/gogo/protobuf/gogoproto:gogoproto"
- "-//go/tools/bazel:bazel_test"
- "-@io_bazel_rules_go//proto:gogofaster_proto"
- "-@io_bazel_rules_go//proto:go_grpc"
- "-@io_bazel_rules_go//proto:go_proto"
- "-@io_bazel_rules_go//proto:go_proto_bootstrap"
Expand All @@ -134,23 +132,10 @@ tasks:
- "-@org_golang_x_text//language:language_test"
- "-//proto:combo_grpc"
- "-//proto:combo_proto"
- "-//proto:gofast_grpc"
- "-//proto:gofast_proto"
- "-//proto:gogofaster_grpc"
- "-//proto:gogofaster_proto"
- "-//proto:gogofast_grpc"
- "-//proto:gogofast_proto"
- "-//proto:gogo_grpc"
- "-//proto:gogo_proto"
- "-//proto:gogoslick_grpc"
- "-//proto:gogoslick_proto"
- "-//proto:gogotypes_grpc"
- "-//proto:gogotypes_proto"
- "-//proto:go_grpc"
- "-//proto:go_proto"
- "-//proto:go_proto_bootstrap"
- "-//proto:go_proto_validate"
- "-//proto:gostring_grpc"
- "-//proto:gostring_proto"
- "-//proto/wkt:any_go_proto"
- "-//proto/wkt:api_go_proto"
Expand Down Expand Up @@ -221,9 +206,6 @@ tasks:
- "-//tests/legacy/examples/proto/embed:embed_proto"
- "-//tests/legacy/examples/proto/embed:go_default_library"
- "-//tests/legacy/examples/proto:go_default_library"
- "-//tests/legacy/examples/proto/gogo:gogo_test"
- "-//tests/legacy/examples/proto/gogo:values_go_proto"
- "-//tests/legacy/examples/proto/gogo:values_proto"
- "-//tests/legacy/examples/proto/gostyle:gostyle_go_proto"
- "-//tests/legacy/examples/proto/gostyle:gostyle_proto"
- "-//tests/legacy/examples/proto/grpc:my_svc_go_proto"
Expand Down Expand Up @@ -310,7 +292,6 @@ tasks:
- "-//tests/legacy/examples/cgo:go_default_library"
- "-//tests/legacy/examples/cgo/cc_dependency:version"
- "-//tests/legacy/examples/cgo/cc_dependency:c_version_so"
- "-//tests/legacy/examples/proto/gogo:gogo_test"
- "-//tests/legacy/examples/proto:proto_pure_test"
- "-//tests/legacy/examples/proto:proto_test"
- "-//tests/legacy/extldflags_rpath:extldflags_rpath_test"
Expand Down
6 changes: 0 additions & 6 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,8 @@ bazel_dep(name = "gazelle", version = "0.34.0")

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
go_deps.module(
path = "github.com/gogo/protobuf",
sum = "h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=",
version = "v1.3.2",
)
use_repo(
go_deps,
"com_github_gogo_protobuf",
"com_github_golang_mock",
"com_github_golang_protobuf",
"org_golang_google_genproto",
Expand Down
1 change: 0 additions & 1 deletion docs/go/core/bzlmod.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ go_deps.from_file(go_mod = "//:go.mod")
# All *direct* Go dependencies of the module have to be listed explicitly.
use_repo(
go_deps,
"com_github_gogo_protobuf",
"com_github_golang_mock",
"com_github_golang_protobuf",
"org_golang_x_net",
Expand Down
6 changes: 0 additions & 6 deletions go/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Go workspace rules
.. Links to other sites and pages
.. _gazelle: tools/gazelle/README.rst
.. _github.com/bazelbuild/bazel-skylib: https://github.com/bazelbuild/bazel-skylib
.. _github.com/gogo/protobuf: https://github.com/gogo/protobuf
.. _github.com/golang/protobuf: https://github.com/golang/protobuf/
.. _github.com/google/protobuf: https://github.com/google/protobuf/
.. _github.com/mwitkow/go-proto-validators: https://github.com/mwitkow/go-proto-validators
Expand Down Expand Up @@ -95,11 +94,6 @@ It also declares some internal repositories not described here.
| Legacy definition for proto plugin. Ideally ``go_rules_dependencies`` should |
| not provide this. |
+-------------------------------------------------+-------------------------------------------+
| :value:`com_github_gogo_protobuf` | `github.com/gogo/protobuf`_ |
+-------------------------------------------------+-------------------------------------------+
| Legacy definition for proto plugins. Ideally ``go_rules_dependencies`` should |
| not provide this. |
+-------------------------------------------------+-------------------------------------------+
| :value:`org_golang_google_genproto` | `google.golang.org/genproto`_ |
+-------------------------------------------------+-------------------------------------------+
| Pre-generated proto libraries for gRPC and Google APIs. Ideally, |
Expand Down
1 change: 0 additions & 1 deletion go/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ bzl_library(
":common",
":nogo",
"//go/private/skylib/lib:versions",
"//proto:gogo",
], # keep
)

Expand Down
28 changes: 2 additions & 26 deletions go/private/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
load("//go/private:common.bzl", "MINIMUM_BAZEL_VERSION")
load("//go/private/skylib/lib:versions.bzl", "versions")
load("//go/private:nogo.bzl", "DEFAULT_NOGO", "go_register_nogo")
load("//proto:gogo.bzl", "gogo_special_proto")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

def go_rules_dependencies(force = False):
Expand Down Expand Up @@ -146,8 +145,8 @@ def go_rules_dependencies(force = False):
#
# * com_google_protobuf has its own dependency macro. We can't load
# the macro here.
# * rules_proto also has a dependency macro. It's only needed by tests and
# by gogo_special_proto. Users will need to declare it anyway.
# * rules_proto also has a dependency macro. It's only needed by tests.
# Users will need to declare it anyway.
# * org_golang_google_grpc has too many dependencies for us to maintain.
# * In general, declaring dependencies here confuses users when they
# declare their own dependencies later. Bazel ignores these.
Expand Down Expand Up @@ -212,29 +211,6 @@ def go_rules_dependencies(force = False):
# Bazel support added in v0.3.0, so no patches needed.
)

# releaser:upgrade-dep gogo protobuf
wrapper(
http_archive,
name = "com_github_gogo_protobuf",
# v1.3.2, latest as of 2023-11-16
urls = [
"https://mirror.bazel.build/github.com/gogo/protobuf/archive/refs/tags/v1.3.2.zip",
"https://github.com/gogo/protobuf/archive/refs/tags/v1.3.2.zip",
],
sha256 = "f89f8241af909ce3226562d135c25b28e656ae173337b3e58ede917aa26e1e3c",
strip_prefix = "protobuf-1.3.2",
patches = [
# releaser:patch-cmd gazelle -repo_root . -go_prefix github.com/gogo/protobuf -go_naming_convention import_alias -proto legacy
Label("//third_party:com_github_gogo_protobuf-gazelle.patch"),
],
patch_args = ["-p1"],
)

wrapper(
gogo_special_proto,
name = "gogo_special_proto",
)

# go_library targets with pre-generated sources for Well Known Types.
# Doesn't belong here, but it would be an annoying source of errors if
# this weren't generated with -proto disable_global.
Expand Down
73 changes: 0 additions & 73 deletions proto/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ load(
)
load(
"//proto/wkt:well_known_types.bzl",
"GOGO_WELL_KNOWN_TYPE_REMAPS",
"PROTO_RUNTIME_DEPS",
"WELL_KNOWN_TYPES_APIV2",
"WELL_KNOWN_TYPE_RULES",
)

go_proto_compiler(
Expand Down Expand Up @@ -51,71 +49,6 @@ go_proto_compiler(
],
)

GOGO_VARIANTS = [
"combo",
"gogo",
"gogofast",
"gogofaster",
"gogoslick",
"gogotypes",
"gostring",
]

[go_proto_compiler(
name = variant + "_proto",
options = GOGO_WELL_KNOWN_TYPE_REMAPS,
plugin = "@com_github_gogo_protobuf//protoc-gen-" + variant,
visibility = ["//visibility:public"],
deps = [
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//protoc-gen-gogo/descriptor:go_default_library",
"@com_github_gogo_protobuf//sortkeys:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",
] + WELL_KNOWN_TYPE_RULES.values(),
) for variant in GOGO_VARIANTS]

go_proto_compiler(
name = "gofast_proto",
plugin = "@com_github_gogo_protobuf//protoc-gen-gofast",
visibility = ["//visibility:public"],
deps = [
"@com_github_golang_protobuf//proto:go_default_library",
] + WELL_KNOWN_TYPE_RULES.values(),
)

[go_proto_compiler(
name = variant + "_grpc",
options = ["plugins=grpc"] + GOGO_WELL_KNOWN_TYPE_REMAPS,
plugin = "@com_github_gogo_protobuf//protoc-gen-" + variant,
visibility = ["//visibility:public"],
deps = [
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_gogo_protobuf//protoc-gen-gogo/descriptor:go_default_library",
"@com_github_gogo_protobuf//sortkeys:go_default_library",
"@com_github_gogo_protobuf//types:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
"@org_golang_x_net//context:go_default_library",
] + WELL_KNOWN_TYPE_RULES.values(),
) for variant in GOGO_VARIANTS]

go_proto_compiler(
name = "gofast_grpc",
options = ["plugins=grpc"],
plugin = "@com_github_gogo_protobuf//protoc-gen-gofast",
visibility = ["//visibility:public"],
deps = [
"@com_github_golang_protobuf//proto:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
"@org_golang_x_net//context:go_default_library",
] + WELL_KNOWN_TYPE_RULES.values(),
)

non_go_reset_target(
name = "protoc",
dep = "@com_google_protobuf//:protoc",
Expand Down Expand Up @@ -158,9 +91,3 @@ bzl_library(
"//proto:compiler",
], # keep
)

bzl_library(
name = "gogo",
srcs = ["gogo.bzl"],
visibility = ["//visibility:public"],
)
7 changes: 0 additions & 7 deletions proto/core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Go Protocol buffers
.. _Gazelle: https://github.com/bazelbuild/bazel-gazelle
.. _Make variable substitution: https://docs.bazel.build/versions/master/be/make-variables.html#make-var-substitution
.. _Bourne shell tokenization: https://docs.bazel.build/versions/master/be/common-definitions.html#sh-tokenization
.. _gogoprotobuf: https://github.com/gogo/protobuf
.. _compiler.bzl: compiler.bzl

.. role:: param(kbd)
Expand Down Expand Up @@ -429,10 +428,6 @@ Several ``go_proto_compiler`` rules are predefined in
* ``go_grpc``: default gRPC plugin.
* ``go_proto_validate``: validator plugin from
github.com/mwitkow/go-proto-validators. Generates ``Validate`` methods.
* gogoprotobuf_ plugins for the variants ``combo``, ``gofast``, ``gogo``,
``gogofast``, ``gogofaster``, ``gogoslick``, ``gogotypes``, ``gostring``.
For each variant, there is a regular version (e.g., ``gogo_proto``) and a
gRPC version (e.g., ``gogo_grpc``).

Providers
---------
Expand Down Expand Up @@ -490,8 +485,6 @@ will only be downloaded if proto rules are used.
Go proto plugin.
* ``@com_github_mwitkow_go_proto_validators
(github.com/mwitkow/go-proto-validators)``: validator plugin.
* ``@com_github_gogo_protobuf (github.com/gogo/protobuf)``: gogoprotobuf
plugins.
* ``@org_golang_google_grpc (github.com/grpc/grpc-go``: gRPC support.
* gRPC dependencies

Expand Down
41 changes: 0 additions & 41 deletions proto/gogo.bzl

This file was deleted.

43 changes: 0 additions & 43 deletions proto/wkt/well_known_types.bzl
Original file line number Diff line number Diff line change
@@ -1,46 +1,3 @@
# NOTE: since protobuf 3.14, the WKTs no longer use these paths. They're only
# used by gogo below. Not clear if that actually works or if we should
# continue supporting gogo.
WELL_KNOWN_TYPE_PACKAGES = {
"any": ("github.com/golang/protobuf/ptypes/any", []),
"api": ("google.golang.org/genproto/protobuf/api", ["source_context", "type"]),
"compiler_plugin": ("github.com/golang/protobuf/protoc-gen-go/plugin", ["descriptor"]),
"descriptor": ("github.com/golang/protobuf/protoc-gen-go/descriptor", []),
"duration": ("github.com/golang/protobuf/ptypes/duration", []),
"empty": ("github.com/golang/protobuf/ptypes/empty", []),
"field_mask": ("google.golang.org/genproto/protobuf/field_mask", []),
"source_context": ("google.golang.org/genproto/protobuf/source_context", []),
"struct": ("github.com/golang/protobuf/ptypes/struct", []),
"timestamp": ("github.com/golang/protobuf/ptypes/timestamp", []),
"type": ("google.golang.org/genproto/protobuf/ptype", ["any", "source_context"]),
"wrappers": ("github.com/golang/protobuf/ptypes/wrappers", []),
}

GOGO_WELL_KNOWN_TYPE_REMAPS = [
"Mgoogle/protobuf/{}.proto=github.com/gogo/protobuf/types".format(wkt)
for wkt, (go_package, _) in WELL_KNOWN_TYPE_PACKAGES.items()
if "protoc-gen-go" not in go_package
] + [
"Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor",
"Mgoogle/protobuf/compiler_plugin.proto=github.com/gogo/protobuf/protoc-gen-gogo/plugin",
]

# NOTE: only used by gogo.
WELL_KNOWN_TYPE_RULES = {
"any": "@com_github_golang_protobuf//ptypes/any",
"api": "@org_golang_google_genproto//protobuf/api",
"compiler_plugin": "@com_github_golang_protobuf//protoc-gen-go/plugin",
"descriptor": "@com_github_golang_protobuf//protoc-gen-go/descriptor",
"duration": "@com_github_golang_protobuf//ptypes/duration",
"empty": "@com_github_golang_protobuf//ptypes/empty",
"field_mask": "@org_golang_google_genproto//protobuf/field_mask",
"source_context": "@org_golang_google_genproto//protobuf/source_context",
"struct": "@com_github_golang_protobuf//ptypes/struct",
"timestamp": "@com_github_golang_protobuf//ptypes/timestamp",
"type": "@org_golang_google_genproto//protobuf/ptype",
"wrappers": "@com_github_golang_protobuf//ptypes/wrappers",
}

PROTO_RUNTIME_DEPS = [
"@com_github_golang_protobuf//proto:go_default_library",
"@org_golang_google_protobuf//proto:go_default_library",
Expand Down
13 changes: 0 additions & 13 deletions tests/bcr/proto/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,3 @@ go_test(
"@org_golang_google_grpc//credentials/insecure",
],
)

go_proto_library(
name = "foo_go_proto_gogo",
compilers = ["@my_rules_go//proto:gogo_proto"],
importpath = "example.com/foo_proto",
protos = [":foo_proto"],
)

go_test(
name = "foo_proto_gogo_test",
srcs = ["foo_proto_test.go"],
deps = [":foo_go_proto_gogo"],
)
Loading

0 comments on commit 3a574d2

Please sign in to comment.