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 f425ce6 commit 637508e
Show file tree
Hide file tree
Showing 24 changed files with 2 additions and 7,254 deletions.
22 changes: 0 additions & 22 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 @@ -131,25 +129,9 @@ tasks:
- "-@org_golang_x_sys//windows/svc/eventlog:eventlog_test"
- "-@org_golang_x_sys//windows/svc:svc_test"
- "-@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:gostring_grpc"
- "-//proto:gostring_proto"
- "-//proto/wkt:any_go_proto"
- "-//proto/wkt:api_go_proto"
- "-//proto/wkt:compiler_plugin_go_proto"
Expand Down Expand Up @@ -219,9 +201,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 @@ -308,7 +287,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 @@ -90,11 +89,6 @@ It also declares some internal repositories not described here.
| This is needed to support both pre-generated and dynamically generated |
| proto libraries. |
+-------------------------------------------------+-------------------------------------------+
| :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 @@ -196,29 +195,6 @@ def go_rules_dependencies(force = False):
patch_args = ["-p1"],
)

# 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 All @@ -39,71 +37,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 @@ -146,9 +79,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 @@ -427,10 +426,6 @@ Several ``go_proto_compiler`` rules are predefined in

* ``go_proto``: default plugin from github.com/golang/protobuf.
* ``go_grpc``: default gRPC plugin.
* 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 @@ -486,8 +481,6 @@ will only be downloaded if proto rules are used.
general proto support.
* ``@com_github_golang_protobuf (github.com/golang/protobuf)``: standard
Go proto 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 637508e

Please sign in to comment.